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


Create Zend_Navigation:

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:

<?php echo $this->navigation()->menu(); ?>

Now, create unit test:

    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:

Login Profile

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.


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.