class IndexController extends Zend_Controller_Action
{
public function indexAction()
{
var_dump($this->getInvokeArg('bootstrap')); // It should NOT output NULL, but an instance of class "Zend_Application_Bootstrap_Bootstrap" under the unit testing environment
}
}
class IndexControllerTest extends Zend_Test_PHPUnit_ControllerTestCase
{
public $application;
public function setUp()
{
$this->application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$this->bootstrap = array($this, 'appBootstrap');
parent::setUp();
}
public function appBootstrap()
{
$this->application->bootstrap();
}
public function testIndexAction() {
$this->dispatch('/');
$this->assertType('Zend_Application_Bootstrap_Bootstrap', $this->_frontController->getParam('bootstrap')); // FAILURE
}
}
Comments
Posted by Matthew Weier O'Phinney (matthew) on 2010-10-28T05:38:00.000+0000
You're doing it wrong.
Simply assign the Zend_Application instance to the $bootstrap property.
The above works perfectly.
Posted by miholeus (miholeus) on 2010-10-28T06:24:30.000+0000
Thanks. I understand now