Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Not an Issue
-
Affects Version/s: 1.11.0
-
Fix Version/s: None
-
Component/s: Zend_Test_PHPUnit
-
Labels:None
Description
IndexController.php
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 } }
IndexControllerTest.php
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 } }
Issue Links
| This issue is dependecy of: | ||||
| ZF-7373 | Zend_Test_PHPUnit fails when Controller Plugins request the 'bootstrap' param |
|
|
|
| This issue is duplicated by: | ||||
| ZF-10039 | Reopen problems with $this->_frontController->getParam('bootstrap') doesn't work under the unit testing environment |
|
|
|
| This issue is related to: | ||||
| ZF-8797 | Using Zend_Test_PHPUnit_ControllerTestCase with Zend_Application,The Resources shuold be reset |
|
|
|
You're doing it wrong.
Simply assign the Zend_Application instance to the $bootstrap property.
The above works perfectly.