ZF-7373: Zend_Test_PHPUnit fails when Controller Plugins request the 'bootstrap' param


When attempting to do the following in a Controller Plugin: \ \

    public function preDispatch($request)
        $bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');

It fails as the bootstrap parameter is not being set upon $this->dispatch() within the X_ControllerTestCase.

Could a $this->run($url) which mimics the Zend_Application::run() be added, that sets the bootstrap param and then executes the dispatch?


Using Zend_Application is not a pre-requisite of using the controller components, and thus, not a pre-requisite of testing your controllers. This can easily be accomplished by the developer in the setUp of their tests.

ZF-8193 includes a work-around for this. As Jason Webster suggested earlier, another work-around involves doing something like the example below in setUp() of the test case. Thanks to [~ralph] for coming up with this code.

public function setUp()
    // $this->bootstrap = ...
    $this->getFrontController()->setParam('bootstrap', $this->bootstrap->getBootstrap());

Resolved in trunk