Issues

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

Issue Type: Improvement Created: 2009-07-23T17:03:07.000+0000 Last Updated: 2010-10-28T00:40:37.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: Khary Sharpe (ksharpe) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Test_PHPUnit

Related issues: - ZF-10607

Attachments:

Description

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

<pre class="highlight">
    .
    .
    .
    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?

Comments

Posted by Jason Webster (jasonistaken) on 2009-08-13T21:30:02.000+0000

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.

Posted by Matthew Turland (elazar) on 2009-12-29T11:03:55.000+0000

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.

<pre class="highlight">
public function setUp()
{
    // $this->bootstrap = ...
    parent::setUp();
    $this->getFrontController()->setParam('bootstrap', $this->bootstrap->getBootstrap());
}

Posted by Matthew Weier O'Phinney (matthew) on 2010-01-13T08:20:04.000+0000

Resolved in trunk

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts