ZF-7580: Zend_Test_PHPUnit_ControllerTestCase doesn't correct work with Zend_Navigation

Issue Type: Bug Created: 2009-08-13T01:32:16.000+0000 Last Updated: 2012-11-20T20:53:08.000+0000 Status: Closed Fix version(s): Reporter: Alexey Grunichev (alexey.grunichev) Assignee: None Tags: - Zend_Test_PHPUnit

Related issues: Attachments:


Create Zend_Navigation:

<pre class="highlight">
protected function _initMenu()
        $view = $this->getResource('view');
        $pages = array(
            array (
                'controller' => 'user',
                'action'     => 'login',
                'label'      => 'Login',
            array (
                'controller' => 'user',
                'action'     => 'profile',
                'label'      => 'Profile',

        $container = new Zend_Navigation($pages);
        return $container;

This menu is displaying in layout:

<pre class="highlight">
<?php echo $this->navigation()->menu(); ?>

Now, create unit test:

<pre class="highlight">
    function testGuestProfile()
        $this->assertQueryContentContains('.navigation a', "Login");
        $this->assertNotQueryContentContains('.navigation a', "Profile");
        $this->assertNotQueryContentContains('.navigation a', "Login");
        $this->assertQueryContentContains('.navigation a', "Profile");

Result: {quote} Failed asserting node DENOTED BY .navigation a DOES NOT CONTAIN content "Login" {quote}

Commented var_dump returns:

<pre class="highlight">

        <a href="/user/login">Login</a>
        <a href="/user/profile">Profile</a>

It seems as Zend_Navigation store stats from previous request and doesn't reset it. The example is trivial, but in real application problem is much complex (acl permissions aren't applied to new request, if I have resources for Zend_Navigation and so forth)

This problem exists only in Zend_Test_PHPUnit environment, so, it doesn't related with Zend_Navigation (that works fine in browser). And in my vision $this->resetRequest() ->resetResponse(); should reset state of initiated resources.


Posted by Rob Allen (rob) on 2012-11-20T20:53:08.000+0000

Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".

Feel free to re-open and provide a patch if you want to fix this issue.

Have you found an issue?

See the Overview section for more details.


© 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.