Index: tests/Zend/Navigation/Page/MvcTest.php =================================================================== --- tests/Zend/Navigation/Page/MvcTest.php (revision 24297) +++ tests/Zend/Navigation/Page/MvcTest.php (working copy) @@ -23,6 +23,7 @@ require_once 'Zend/Navigation/Page/Mvc.php'; require_once 'Zend/Controller/Request/Http.php'; require_once 'Zend/Controller/Router/Route.php'; +require_once 'Zend/Controller/Router/Route/Regex.php'; /** * Tests the class Zend_Navigation_Page_Mvc @@ -345,35 +346,82 @@ $page->setParams(array()); $this->assertEquals(array(), $page->getParams()); } + + /** + * @group ZF-10465 + */ + public function testSetAndGetEncodeUrl() + { + $page = new Zend_Navigation_Page_Mvc(array( + 'label' => 'foo', + 'action' => 'index', + 'controller' => 'index', + )); + + $page->setEncodeUrl(false); + $this->assertEquals(false, $page->getEncodeUrl()); + } + + /** + * @group ZF-10465 + */ + public function testEncodeUrlIsRouteAware() + { + $page = new Zend_Navigation_Page_Mvc(array( + 'label' => 'foo', + 'route' => 'myroute', + 'encodeUrl' => false, + 'params' => array( + 'contentKey' => 'pagexy/subpage', + ) + )); + $this->_front->getRouter()->addRoute( + 'myroute', + new Zend_Controller_Router_Route_Regex( + '(.+)\.html', + array( + 'module' => 'default', + 'controller' => 'foobar', + 'action' => 'bazbat', + ), + array( + 1 => 'contentKey' + ), + '%s.html' + ) + ); + + $this->assertEquals('/pagexy/subpage.html', $page->getHref()); + } + public function testToArrayMethod() { $options = array( - 'label' => 'foo', - 'action' => 'index', + 'label' => 'foo', + 'action' => 'index', 'controller' => 'index', - 'module' => 'test', - 'id' => 'my-id', - 'class' => 'my-class', - 'title' => 'my-title', - 'target' => 'my-target', - 'order' => 100, - 'active' => true, - 'visible' => false, + 'module' => 'test', + 'id' => 'my-id', + 'class' => 'my-class', + 'title' => 'my-title', + 'target' => 'my-target', + 'order' => 100, + 'active' => true, + 'visible' => false, + 'encodeUrl' => false, - 'foo' => 'bar', + 'foo' => 'bar', 'meaning' => 42 ); $page = new Zend_Navigation_Page_Mvc($options); - $toArray = $page->toArray(); - $options['reset_params'] = true; - $options['route'] = null; - $options['params'] = array(); - $options['rel'] = array(); - $options['rev'] = array(); + $options['route'] = null; + $options['params'] = array(); + $options['rel'] = array(); + $options['rev'] = array(); $this->assertEquals(array(), array_diff_assoc($options, $page->toArray()));