Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

When displaying navigations three times last navigation has data of prev... #4140

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions library/Zend/View/Helper/Navigation.php
Expand Up @@ -190,6 +190,10 @@ public function findHelper($proxy, $strict = true)
$helper->setContainer();
$this->inject($helper);
$this->injected[$hash] = true;
} else {
if ($this->getInjectContainer()) {
$helper->setContainer($container);
}
}

return $helper;
Expand Down
9 changes: 9 additions & 0 deletions tests/ZendTest/View/Helper/Navigation/NavigationTest.php
Expand Up @@ -132,6 +132,15 @@ public function testDisablingContainerInjection()
$this->assertEquals($expected, $actual);
}

public function testMultipleNavigationsAndOneMenuDisplayedTwoTimes()
{
$expected = $this->_helper->setContainer($this->_nav1)->menu()->getContainer();
$this->_helper->setContainer($this->_nav2)->menu()->getContainer();
$actual = $this->_helper->setContainer($this->_nav1)->menu()->getContainer();

$this->assertEquals($expected, $actual);
}

public function testServiceManagerIsUsedToRetrieveContainer()
{
$container = new Container;
Expand Down