From 038715556de440488762330b26d3278197c6a6cb Mon Sep 17 00:00:00 2001 From: Jurian Sluiman Date: Wed, 27 Jun 2012 09:50:16 +0200 Subject: [PATCH 01/10] Update factory to use router instead of url view helper Along the lines of the previous commit juriansluiman@08fe3880df9d533f1af7196a2468597dd086e839 this commit updates the factory to reflect the new Mvc href construction. --- src/Service/AbstractNavigationFactory.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Service/AbstractNavigationFactory.php b/src/Service/AbstractNavigationFactory.php index 5040bf7..2577e69 100644 --- a/src/Service/AbstractNavigationFactory.php +++ b/src/Service/AbstractNavigationFactory.php @@ -26,9 +26,9 @@ use Zend\Navigation\Navigation; use Zend\Navigation\Page\Mvc as MvcPage; use Zend\Mvc\Router\RouteMatch; +use Zend\Mvc\Router\RouteStackInterface as Router; use Zend\ServiceManager\FactoryInterface; use Zend\ServiceManager\ServiceLocatorInterface; -use Zend\View\Helper\Url as UrlHelper; /** * Abstract navigation factory @@ -82,11 +82,11 @@ protected function getPages(ServiceLocatorInterface $serviceLocator) } $application = $serviceLocator->get('Application'); - $urlHelper = $serviceLocator->get('ViewHelperManager')->get('url'); $routeMatch = $application->getMvcEvent()->getRouteMatch(); + $router = $application->getMvcEvent()->getRouter(); $pages = $this->getPagesFromConfig($configuration['navigation'][$this->getName()]); - $this->pages = $this->injectComponents($pages, $routeMatch, $urlHelper); + $this->pages = $this->injectComponents($pages, $routeMatch, $router); } return $this->pages; } @@ -125,6 +125,7 @@ protected function getPagesFromConfig($config = null) * @return mixed */ protected function injectComponents(array $pages, RouteMatch $routeMatch = null, UrlHelper $urlHelper = null) + protected function injectComponents(array $pages, RouteMatch $routeMatch = null, Router $router = null) { foreach($pages as &$page) { $hasMvc = isset($page['action']) || isset($page['controller']) || isset($page['route']); @@ -132,13 +133,13 @@ protected function injectComponents(array $pages, RouteMatch $routeMatch = null, if (!isset($page['routeMatch']) && $routeMatch) { $page['routeMatch'] = $routeMatch; } - if (!isset($page['urlHelper']) && $urlHelper) { - $page['urlHelper'] = $urlHelper; + if (!isset($page['router'])) { + $page['router'] = $router; } } if (isset($page['pages'])) { - $page['pages'] = $this->injectComponents($page['pages'], $routeMatch, $urlHelper); + $page['pages'] = $this->injectComponents($page['pages'], $routeMatch, $router); } } return $pages; From bcfbbb71dd16fe6d5b08e0dae8f247efbb860224 Mon Sep 17 00:00:00 2001 From: Jurian Sluiman Date: Wed, 27 Jun 2012 10:16:40 +0200 Subject: [PATCH 02/10] Replace urlHelper in accessor/mutators As with the changes from juriansluiman@08fe388 the tests which simply set/get the url helper are replaced with set/get the router object. Some tests still fail (needs update on Mvc page) or need a rewrite for the test (since the api of the router is different from the router) --- test/NavigationTest.php | 8 ++-- test/Page/MvcTest.php | 79 ++++++++++++++++--------------------- test/ServiceFactoryTest.php | 2 +- 3 files changed, 38 insertions(+), 51 deletions(-) diff --git a/test/NavigationTest.php b/test/NavigationTest.php index 1615407..320b637 100644 --- a/test/NavigationTest.php +++ b/test/NavigationTest.php @@ -40,13 +40,13 @@ class NavigationTest extends \PHPUnit_Framework_TestCase * @var Zend_Navigation */ private $_navigation; - + protected function setUp() { parent::setUp(); $this->_navigation = new \Zend\Navigation\Navigation(); } - + protected function tearDown() { $this->_navigation = null; @@ -55,7 +55,7 @@ protected function tearDown() /** * Testing that navigation order is done correctly - * + * * @group ZF-8337 * @group ZF-8313 */ @@ -78,5 +78,5 @@ public function testNavigationArraySortsCorrectly() $this->assertEquals('page1', $pages[1]['uri']); $this->assertEquals('page2', $pages[2]['uri']); } - + } diff --git a/test/Page/MvcTest.php b/test/Page/MvcTest.php index 9505056..16cc803 100644 --- a/test/Page/MvcTest.php +++ b/test/Page/MvcTest.php @@ -21,15 +21,14 @@ namespace ZendTest\Navigation\Page; -use PHPUnit_Framework_TestCase as TestCase, - Zend\View\Helper\Url as UrlHelper, - Zend\Mvc\Router\RouteMatch, - Zend\Mvc\Router\Http\Regex as RegexRoute, - Zend\Mvc\Router\Http\Literal as LiteralRoute, - Zend\Mvc\Router\Http\TreeRouteStack, - Zend\Navigation\Page, - Zend\Navigation, - ZendTest\Navigation\TestAsset; +use PHPUnit_Framework_TestCase as TestCase; +use Zend\Mvc\Router\RouteMatch; +use Zend\Mvc\Router\Http\Regex as RegexRoute; +use Zend\Mvc\Router\Http\Literal as LiteralRoute; +use Zend\Mvc\Router\Http\TreeRouteStack; +use Zend\Navigation\Page; +use Zend\Navigation; +use ZendTest\Navigation\TestAsset; /** * Tests the class Zend_Navigation_Page_Mvc @@ -43,10 +42,6 @@ */ class MvcTest extends TestCase { - protected $_front; - protected $_oldRequest; - protected $_oldRouter; - protected function setUp() { $this->route = new RegexRoute( @@ -62,10 +57,6 @@ protected function setUp() $this->routeMatch = new RouteMatch(array()); $this->routeMatch->setMatchedRouteName('default'); - - $this->urlHelper = new UrlHelper(); - $this->urlHelper->setRouter($this->router); - $this->urlHelper->setRouteMatch($this->routeMatch); } protected function tearDown() @@ -80,7 +71,7 @@ public function testHrefGeneratedByUrlHelperRequiresNoRoute() 'controller' => 'index' )); $page->setRouteMatch($this->routeMatch); - $page->setUrlHelper($this->urlHelper); + $page->setRouter($this->router); $page->setAction('view'); $page->setController('news'); @@ -117,11 +108,7 @@ public function testHrefGeneratedIsRouteAware() 'page' => 1, )); - $urlHelper = new UrlHelper(); - $urlHelper->setRouter($router); - $urlHelper->setRouteMatch($routeMatch); - - $page->setUrlHelper($urlHelper); + $page->setRouter($router); $page->setRouteMatch($routeMatch); $this->assertEquals('/lolcat/myaction/1337', $page->getHref()); @@ -142,11 +129,7 @@ public function testIsActiveReturnsTrueWhenMatchingRoute() $routeMatch = new RouteMatch(array()); $routeMatch->setMatchedRouteName('lolfish'); - $urlHelper = new UrlHelper; - $urlHelper->setRouter($router); - $urlHelper->setRouteMatch($routeMatch); - - $page->setUrlHelper($urlHelper); + $page->setRouter($router); $page->setRouteMatch($routeMatch); $this->assertEquals(true, $page->isActive()); @@ -157,8 +140,6 @@ public function testIsActiveReturnsFalseWhenNoRouteAndNoMatchedRouteNameIsSet() $page = new Page\Mvc(); $routeMatch = new RouteMatch(array()); - $this->urlHelper->setRouteMatch($routeMatch); - $page->setRouteMatch($routeMatch); $this->assertFalse($page->isActive()); @@ -193,13 +174,14 @@ public function testGetHrefWithFragmentIdentifier() $this->routeMatch->setMatchedRouteName('myroute'); $page->setRouteMatch($this->routeMatch); - $page->setUrlHelper($this->urlHelper); + $page->setRouter($this->router); $this->assertEquals('/lolcat/myaction/1337#qux', $page->getHref()); } public function testIsActiveReturnsTrueOnIdenticalControllerAction() { + $this->markTestSkipped(); $page = new Page\Mvc(array( 'action' => 'index', 'controller' => 'index' @@ -219,6 +201,7 @@ public function testIsActiveReturnsTrueOnIdenticalControllerAction() public function testIsActiveReturnsFalseOnDifferentControllerAction() { + $this->markTestSkipped(); $page = new Page\Mvc(array( 'action' => 'bar', 'controller' => 'index' @@ -238,6 +221,7 @@ public function testIsActiveReturnsFalseOnDifferentControllerAction() public function testIsActiveReturnsTrueOnIdenticalIncludingPageParams() { + $this->markTestSkipped(); $page = new Page\Mvc(array( 'label' => 'foo', 'action' => 'view', @@ -262,6 +246,7 @@ public function testIsActiveReturnsTrueOnIdenticalIncludingPageParams() public function testIsActiveReturnsTrueWhenRequestHasMoreParams() { + $this->markTestSkipped(); $page = new Page\Mvc(array( 'label' => 'foo', 'action' => 'view', @@ -283,6 +268,7 @@ public function testIsActiveReturnsTrueWhenRequestHasMoreParams() public function testIsActiveReturnsFalseWhenRequestHasLessParams() { + $this->markTestSkipped(); $page = new Page\Mvc(array( 'label' => 'foo', 'action' => 'view', @@ -435,6 +421,7 @@ public function testToArrayMethod() public function testSpecifyingAnotherUrlHelperToGenerateHrefs() { + $this->markTestSkipped(); $newHelper = new TestAsset\UrlHelper(); $page = new Page\Mvc(); @@ -446,44 +433,44 @@ public function testSpecifyingAnotherUrlHelperToGenerateHrefs() $this->assertEquals($expected, $actual); } - public function testDefaultUrlHelperCanBeSetWithConstructor() + public function testDefaultRouterCanBeSetWithConstructor() { $page = new Page\Mvc(array( - 'label' => 'foo', - 'action' => 'index', - 'controller' => 'index', - 'defaultUrlHelper' => $this->urlHelper + 'label' => 'foo', + 'action' => 'index', + 'controller' => 'index', + 'defaultRouter' => $this->router )); - $this->assertEquals($this->urlHelper, $page->getDefaultUrlHelper()); - $page->setDefaultUrlHelper(null); + $this->assertEquals($this->router, $page->getDefaultRouter()); + $page->setDefaultRouter(null); } - public function testDefaultUrlHelperCanBeSetWithGetter() + public function testDefaultRouterCanBeSetWithGetter() { $page = new Page\Mvc(array( 'label' => 'foo', 'action' => 'index', 'controller' => 'index', )); - $page->setDefaultUrlHelper($this->urlHelper); + $page->setDefaultRouter($this->router); - $this->assertEquals($this->urlHelper, $page->getDefaultUrlHelper()); - $page->setDefaultUrlHelper(null); + $this->assertEquals($this->router, $page->getDefaultRouter()); + $page->setDefaultRouter(null); } - public function testNoExceptionForGetHrefIfDefaultUrlHelperIsSet() + public function testNoExceptionForGetHrefIfDefaultRouterIsSet() { $page = new Page\Mvc(array( 'label' => 'foo', 'action' => 'index', 'controller' => 'index', - 'defaultUrlHelper' => $this->urlHelper + 'defaultRouter' => $this->router )); - // If the default url helper is not used an exception will be thrown. + // If the default router is not used an exception will be thrown. // This method intentionally has no assertion. $page->getHref(); - $page->setDefaultUrlHelper(null); + $page->setDefaultRouter(null); } } diff --git a/test/ServiceFactoryTest.php b/test/ServiceFactoryTest.php index 74952ef..5863412 100644 --- a/test/ServiceFactoryTest.php +++ b/test/ServiceFactoryTest.php @@ -133,7 +133,7 @@ public function testMvcPagesGetInjectedWithComponents() $recursive = function($that, $pages) use (&$recursive) { foreach($pages as $page) { if ($page instanceof MvcPage) { - $that->assertInstanceOf('Zend\View\Helper\Url', $page->getUrlHelper()); + $that->assertInstanceOf('Zend\Mvc\Router\RouteStackInterface', $page->getRouter()); $that->assertInstanceOf('Zend\Mvc\Router\RouteMatch', $page->getRouteMatch()); } From 080a7991664cb4f8fcf2ee3dc29eb306777e8e5f Mon Sep 17 00:00:00 2001 From: Jurian Sluiman Date: Wed, 27 Jun 2012 15:31:06 +0200 Subject: [PATCH 03/10] Use routeMatch to create href If routeMatch is used, but no route is known, get the name of the route from the routeMatch. --- src/Page/Mvc.php | 13 ++++++++++++- test/Page/MvcTest.php | 5 +++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Page/Mvc.php b/src/Page/Mvc.php index f4b821d..26dc0d4 100644 --- a/src/Page/Mvc.php +++ b/src/Page/Mvc.php @@ -200,7 +200,18 @@ public function getHref() $params['action'] = $param; } - $options = array('name' => $this->getRoute()); + switch (true) { + case ($this->getRoute() !== null): + $name = $this->getRoute(); + break; + case ($this->getRouteMatch() !== null): + $name = $this->getRouteMatch()->getMatchedRouteName(); + break; + default: + throw new Exception\DomainException('No route name could be found'); + } + + $options = array('name' => $name); $url = $router->assemble($params, $options); // Add the fragment identifier if it is set diff --git a/test/Page/MvcTest.php b/test/Page/MvcTest.php index 16cc803..2a728f5 100644 --- a/test/Page/MvcTest.php +++ b/test/Page/MvcTest.php @@ -63,7 +63,7 @@ protected function tearDown() { } - public function testHrefGeneratedByUrlHelperRequiresNoRoute() + public function testHrefGeneratedByRouterRequiresNoRoute() { $page = new Page\Mvc(array( 'label' => 'foo', @@ -465,7 +465,8 @@ public function testNoExceptionForGetHrefIfDefaultRouterIsSet() 'label' => 'foo', 'action' => 'index', 'controller' => 'index', - 'defaultRouter' => $this->router + 'route' => 'default', + 'defaultRouter' => $this->router )); // If the default router is not used an exception will be thrown. From 1a2e375d478afa36a98742a679e416f3b8bf36d2 Mon Sep 17 00:00:00 2001 From: Jurian Sluiman Date: Wed, 27 Jun 2012 15:49:48 +0200 Subject: [PATCH 04/10] Update skipped tests to let all tests pass Temporarily disabled tests are updated so every test reflects the inital change from juriansluiman@08fe3880df9d533f1af7196a2468597dd086e839 --- test/Page/MvcTest.php | 26 +++++--------------- test/TestAsset/{UrlHelper.php => Router.php} | 4 +-- 2 files changed, 8 insertions(+), 22 deletions(-) rename test/TestAsset/{UrlHelper.php => Router.php} (86%) diff --git a/test/Page/MvcTest.php b/test/Page/MvcTest.php index 2a728f5..dc53be4 100644 --- a/test/Page/MvcTest.php +++ b/test/Page/MvcTest.php @@ -181,7 +181,6 @@ public function testGetHrefWithFragmentIdentifier() public function testIsActiveReturnsTrueOnIdenticalControllerAction() { - $this->markTestSkipped(); $page = new Page\Mvc(array( 'action' => 'index', 'controller' => 'index' @@ -192,8 +191,6 @@ public function testIsActiveReturnsTrueOnIdenticalControllerAction() 'action' => 'index', )); - $this->urlHelper->setRouteMatch($routeMatch); - $page->setRouteMatch($routeMatch); $this->assertTrue($page->isActive()); @@ -201,7 +198,6 @@ public function testIsActiveReturnsTrueOnIdenticalControllerAction() public function testIsActiveReturnsFalseOnDifferentControllerAction() { - $this->markTestSkipped(); $page = new Page\Mvc(array( 'action' => 'bar', 'controller' => 'index' @@ -212,8 +208,6 @@ public function testIsActiveReturnsFalseOnDifferentControllerAction() 'action' => 'index', )); - $this->urlHelper->setRouteMatch($routeMatch); - $page->setRouteMatch($routeMatch); $this->assertFalse($page->isActive()); @@ -221,7 +215,6 @@ public function testIsActiveReturnsFalseOnDifferentControllerAction() public function testIsActiveReturnsTrueOnIdenticalIncludingPageParams() { - $this->markTestSkipped(); $page = new Page\Mvc(array( 'label' => 'foo', 'action' => 'view', @@ -237,8 +230,6 @@ public function testIsActiveReturnsTrueOnIdenticalIncludingPageParams() 'id' => '1337' )); - $this->urlHelper->setRouteMatch($routeMatch); - $page->setRouteMatch($routeMatch); $this->assertTrue($page->isActive()); @@ -246,7 +237,6 @@ public function testIsActiveReturnsTrueOnIdenticalIncludingPageParams() public function testIsActiveReturnsTrueWhenRequestHasMoreParams() { - $this->markTestSkipped(); $page = new Page\Mvc(array( 'label' => 'foo', 'action' => 'view', @@ -259,8 +249,6 @@ public function testIsActiveReturnsTrueWhenRequestHasMoreParams() 'id' => '1337', )); - $this->urlHelper->setRouteMatch($routeMatch); - $page->setRouteMatch($routeMatch); $this->assertTrue($page->isActive()); @@ -268,7 +256,6 @@ public function testIsActiveReturnsTrueWhenRequestHasMoreParams() public function testIsActiveReturnsFalseWhenRequestHasLessParams() { - $this->markTestSkipped(); $page = new Page\Mvc(array( 'label' => 'foo', 'action' => 'view', @@ -284,8 +271,6 @@ public function testIsActiveReturnsFalseWhenRequestHasLessParams() 'id' => null )); - $this->urlHelper->setRouteMatch($routeMatch); - $page->setRouteMatch($routeMatch); $this->assertFalse($page->isActive()); @@ -421,13 +406,14 @@ public function testToArrayMethod() public function testSpecifyingAnotherUrlHelperToGenerateHrefs() { - $this->markTestSkipped(); - $newHelper = new TestAsset\UrlHelper(); + $newRouter = new TestAsset\Router(); - $page = new Page\Mvc(); - $page->setUrlHelper($newHelper); + $page = new Page\Mvc(array( + 'route' => 'default' + )); + $page->setRouter($newRouter); - $expected = TestAsset\UrlHelper::RETURN_URL; + $expected = TestAsset\Router::RETURN_URL; $actual = $page->getHref(); $this->assertEquals($expected, $actual); diff --git a/test/TestAsset/UrlHelper.php b/test/TestAsset/Router.php similarity index 86% rename from test/TestAsset/UrlHelper.php rename to test/TestAsset/Router.php index 0880d3b..f393d2d 100644 --- a/test/TestAsset/UrlHelper.php +++ b/test/TestAsset/Router.php @@ -28,11 +28,11 @@ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class UrlHelper extends \Zend\View\Helper\Url +class Router extends \Zend\Mvc\Router\Http\TreeRouteStack { const RETURN_URL = 'spotify:track:2nd6CTjR9zjHGT0QtpfLHe'; - public function __invoke($name = null, array $params = array(), array $options = array(), $reuseMatchedParams = false) + public function assemble(array $params = array(), array $options = array()) { return self::RETURN_URL; } From a322f86ddc727f0dcea2e90512a44936efeea86f Mon Sep 17 00:00:00 2001 From: Jurian Sluiman Date: Fri, 29 Jun 2012 11:48:11 +0200 Subject: [PATCH 05/10] Fix typo after rebase --- src/Service/AbstractNavigationFactory.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Service/AbstractNavigationFactory.php b/src/Service/AbstractNavigationFactory.php index 2577e69..1ae56e1 100644 --- a/src/Service/AbstractNavigationFactory.php +++ b/src/Service/AbstractNavigationFactory.php @@ -124,7 +124,6 @@ protected function getPagesFromConfig($config = null) * @param UrlHelper $urlHelper * @return mixed */ - protected function injectComponents(array $pages, RouteMatch $routeMatch = null, UrlHelper $urlHelper = null) protected function injectComponents(array $pages, RouteMatch $routeMatch = null, Router $router = null) { foreach($pages as &$page) { From 7019dbf88939d0ceb46cc4fcb023a5abb5d1edaf Mon Sep 17 00:00:00 2001 From: Maks3w Date: Mon, 9 Jul 2012 16:19:42 +0200 Subject: [PATCH 06/10] [CS][Library] Set File Header http://framework.zend.com/wiki/display/ZFDEV2/Coding+Standards#CodingStandards-Files The following script replaces the content between PHP open tag and namespace declaration. for COMPONENT in $(ls -d *) do for FILE in $(find $COMPONENT -name "*.php") do BLOCK="\/\*\*\n \* Zend Framework \(http:\/\/framework\.zend\.com\/\)\n \*\n \* \@link http:\/\/github\.com\/zendframework\/zf2 for the canonical source repository\n \* \@copyright Copyright \(c\) 2005-2012 Zend Technologies USA Inc\. \(http:\/\/www\.zend\.com\)\n \* \@license http:\/\/framework\.zend\.com\/license\/new-bsd New BSD License\n \* \@package Zend_$COMPONENT\n \*\/" perl -0777 -i -pe "s/(<\?php(\s*.*)*\nn)/ Date: Mon, 9 Jul 2012 16:34:21 +0200 Subject: [PATCH 07/10] [CS][test] Remove @copyright & @license for fl in $(find . -name "*.php"); do mv $fl $fl.old; sed '/@copyright/d' $fl.old > $fl; rm -f $fl.old; done; for fl in $(find . -name "*.php"); do mv $fl $fl.old; sed '/@license/d' $fl.old > $fl; rm -f $fl.old; done; --- test/ContainerTest.php | 4 ---- test/NavigationTest.php | 4 ---- test/Page/MvcTest.php | 4 ---- test/Page/PageFactoryTest.php | 4 ---- test/Page/PageTest.php | 4 ---- test/Page/UriTest.php | 4 ---- test/ServiceFactoryTest.php | 4 ---- test/TestAsset/AbstractContainer.php | 4 ---- test/TestAsset/FileNavigationFactory.php | 2 +- test/TestAsset/InvalidPage.php | 4 ---- test/TestAsset/Page.php | 4 ---- test/TestAsset/Router.php | 4 ---- 12 files changed, 1 insertion(+), 45 deletions(-) diff --git a/test/ContainerTest.php b/test/ContainerTest.php index 3b75b5e..69fa158 100644 --- a/test/ContainerTest.php +++ b/test/ContainerTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Navigation * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Navigation; @@ -31,8 +29,6 @@ * @category Zend * @package Zend_Navigation * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Navigation */ class ContainerTest extends \PHPUnit_Framework_TestCase diff --git a/test/NavigationTest.php b/test/NavigationTest.php index 320b637..2b48aa2 100644 --- a/test/NavigationTest.php +++ b/test/NavigationTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Navigation * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Navigation; @@ -30,8 +28,6 @@ * @category Zend * @package Zend_Navigation * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Navigation */ class NavigationTest extends \PHPUnit_Framework_TestCase diff --git a/test/Page/MvcTest.php b/test/Page/MvcTest.php index dc53be4..46976a1 100644 --- a/test/Page/MvcTest.php +++ b/test/Page/MvcTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Navigation * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Navigation\Page; @@ -36,8 +34,6 @@ * @category Zend * @package Zend_Navigation * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Navigation */ class MvcTest extends TestCase diff --git a/test/Page/PageFactoryTest.php b/test/Page/PageFactoryTest.php index 24da6b5..cb89907 100644 --- a/test/Page/PageFactoryTest.php +++ b/test/Page/PageFactoryTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Navigation * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Navigation; @@ -31,8 +29,6 @@ * @category Zend * @package Zend_Navigation * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Navigation */ class PageFactoryTest extends \PHPUnit_Framework_TestCase diff --git a/test/Page/PageTest.php b/test/Page/PageTest.php index 5d12aae..fc9f830 100644 --- a/test/Page/PageTest.php +++ b/test/Page/PageTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Navigation * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Navigation\Page; @@ -34,8 +32,6 @@ * @category Zend * @package Zend_Navigation * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Navigation */ class PageTest extends \PHPUnit_Framework_TestCase diff --git a/test/Page/UriTest.php b/test/Page/UriTest.php index 917c164..2c9dfbc 100644 --- a/test/Page/UriTest.php +++ b/test/Page/UriTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Navigation * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Navigation\Page; @@ -29,8 +27,6 @@ * @category Zend * @package Zend_Navigation * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Navigation */ class UriTest extends \PHPUnit_Framework_TestCase diff --git a/test/ServiceFactoryTest.php b/test/ServiceFactoryTest.php index eb835c9..c642e6d 100644 --- a/test/ServiceFactoryTest.php +++ b/test/ServiceFactoryTest.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Navigation * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Navigation; @@ -36,8 +34,6 @@ * @category Zend * @package Zend_Navigation * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Navigation */ class ServiceFactoryTest extends \PHPUnit_Framework_TestCase diff --git a/test/TestAsset/AbstractContainer.php b/test/TestAsset/AbstractContainer.php index 52634a0..aa9c0d0 100644 --- a/test/TestAsset/AbstractContainer.php +++ b/test/TestAsset/AbstractContainer.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Navigation * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Navigation\TestAsset; @@ -25,8 +23,6 @@ * @category Zend * @package Zend_Navigation * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ class AbstractContainer extends \Zend\Navigation\AbstractContainer { diff --git a/test/TestAsset/FileNavigationFactory.php b/test/TestAsset/FileNavigationFactory.php index 32b810c..9d17389 100644 --- a/test/TestAsset/FileNavigationFactory.php +++ b/test/TestAsset/FileNavigationFactory.php @@ -10,4 +10,4 @@ protected function getName() { return 'file'; } -} \ No newline at end of file +} diff --git a/test/TestAsset/InvalidPage.php b/test/TestAsset/InvalidPage.php index 3dfd537..5331904 100644 --- a/test/TestAsset/InvalidPage.php +++ b/test/TestAsset/InvalidPage.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Navigation * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Navigation\TestAsset; @@ -25,8 +23,6 @@ * @category Zend * @package Zend_Navigation * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ class InvalidPage { diff --git a/test/TestAsset/Page.php b/test/TestAsset/Page.php index 5ad98b3..3443204 100644 --- a/test/TestAsset/Page.php +++ b/test/TestAsset/Page.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Navigation * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Navigation\TestAsset; @@ -27,8 +25,6 @@ * @category Zend * @package Zend_Navigation * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ class Page extends AbstractPage { diff --git a/test/TestAsset/Router.php b/test/TestAsset/Router.php index f393d2d..0c39927 100644 --- a/test/TestAsset/Router.php +++ b/test/TestAsset/Router.php @@ -15,8 +15,6 @@ * @category Zend * @package Zend_Navigation * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Navigation\TestAsset; @@ -25,8 +23,6 @@ * @category Zend * @package Zend_Navigation * @subpackage UnitTests - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License */ class Router extends \Zend\Mvc\Router\Http\TreeRouteStack { From 6bb2f7b84dab0cafb8c5f09fad94c3b8f0390f16 Mon Sep 17 00:00:00 2001 From: Maks3w Date: Mon, 9 Jul 2012 16:41:27 +0200 Subject: [PATCH 08/10] [CS][Tests] Set File Header http://framework.zend.com/wiki/display/ZFDEV2/Coding+Standards#CodingStandards-Files The following script replaces the content between PHP open tag and namespace declaration. for COMPONENT in $(ls -d *) do for FILE in $(find $COMPONENT -name "*.php") do BLOCK="\/\*\*\n \* Zend Framework \(http:\/\/framework\.zend\.com\/\)\n \*\n \* \@link http:\/\/github\.com\/zendframework\/zf2 for the canonical source repository\n \* \@copyright Copyright \(c\) 2005-2012 Zend Technologies USA Inc\. \(http:\/\/www\.zend\.com\)\n \* \@license http:\/\/framework\.zend\.com\/license\/new-bsd New BSD License\n \* \@package Zend_$COMPONENT\n \*\/" perl -0777 -i -pe "s/(<\?php(\s*.*)*\nn)/ Date: Thu, 28 Jun 2012 19:23:29 +0200 Subject: [PATCH 09/10] Fix use statements in Zend\Navigation --- src/AbstractContainer.php | 10 +++++----- src/Page/AbstractPage.php | 10 +++++----- src/Page/Mvc.php | 1 + test/ContainerTest.php | 6 +++--- test/Page/PageFactoryTest.php | 4 ++-- test/Page/PageTest.php | 10 +++++----- 6 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/AbstractContainer.php b/src/AbstractContainer.php index bab0798..de83f91 100644 --- a/src/AbstractContainer.php +++ b/src/AbstractContainer.php @@ -10,11 +10,11 @@ namespace Zend\Navigation; -use Countable, - RecursiveIterator, - RecursiveIteratorIterator, - Traversable, - Zend\Stdlib\ArrayUtils; +use Countable; +use RecursiveIterator; +use RecursiveIteratorIterator; +use Traversable; +use Zend\Stdlib\ArrayUtils; /** * Zend_Navigation_Container diff --git a/src/Page/AbstractPage.php b/src/Page/AbstractPage.php index 96bed1a..7f115c5 100644 --- a/src/Page/AbstractPage.php +++ b/src/Page/AbstractPage.php @@ -10,11 +10,11 @@ namespace Zend\Navigation\Page; -use Traversable, - Zend\Acl\Resource\ResourceInterface as AclResource, - Zend\Navigation\AbstractContainer, - Zend\Navigation\Exception, - Zend\Stdlib\ArrayUtils; +use Traversable; +use Zend\Acl\Resource\ResourceInterface as AclResource; +use Zend\Navigation\AbstractContainer; +use Zend\Navigation\Exception; +use Zend\Stdlib\ArrayUtils; /** * Base class for Zend\Navigation\Page pages diff --git a/src/Page/Mvc.php b/src/Page/Mvc.php index 63593d5..2691eda 100644 --- a/src/Page/Mvc.php +++ b/src/Page/Mvc.php @@ -13,6 +13,7 @@ use Zend\Mvc\Router\RouteMatch; use Zend\Mvc\Router\RouteStackInterface; use Zend\Navigation\Exception; +use Zend\View\Helper\Url as UrlHelper; /** * Represents a page that is defined using controller, action, route diff --git a/test/ContainerTest.php b/test/ContainerTest.php index e7f1816..2d6cb8f 100644 --- a/test/ContainerTest.php +++ b/test/ContainerTest.php @@ -10,9 +10,9 @@ namespace ZendTest\Navigation; -use Zend\Navigation, - Zend\Navigation\Page, - Zend\Config; +use Zend\Navigation; +use Zend\Navigation\Page; +use Zend\Config; /** * Tests the class Zend_Navigation_Container diff --git a/test/Page/PageFactoryTest.php b/test/Page/PageFactoryTest.php index a28e16f..a0db371 100644 --- a/test/Page/PageFactoryTest.php +++ b/test/Page/PageFactoryTest.php @@ -10,8 +10,8 @@ namespace ZendTest\Navigation; -use Zend\Navigation\Page\AbstractPage, - Zend\Navigation; +use Zend\Navigation\Page\AbstractPage; +use Zend\Navigation; /** * Tests Zend_Navigation_Page::factory() diff --git a/test/Page/PageTest.php b/test/Page/PageTest.php index cacddaf..4372b90 100644 --- a/test/Page/PageTest.php +++ b/test/Page/PageTest.php @@ -10,11 +10,11 @@ namespace ZendTest\Navigation\Page; -use Zend\Navigation\Page\AbstractPage, - Zend\Navigation\Page\Mvc, - Zend\Navigation\Page\Uri, - Zend\Navigation, - Zend\Config; +use Zend\Navigation\Page\AbstractPage; +use Zend\Navigation\Page\Mvc; +use Zend\Navigation\Page\Uri; +use Zend\Navigation; +use Zend\Config; /** * Tests the class Zend_Navigation_Page From aabe1c066fbf34997a1413cfc50aaae1d907c42a Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Mon, 9 Jul 2012 12:28:01 -0500 Subject: [PATCH 10/10] [zen-49] Sort import statements - Import statements should be sorted alphabetically - Same applies to "implements" --- src/AbstractContainer.php | 2 +- src/Exception/BadMethodCallException.php | 5 ++--- src/Exception/DomainException.php | 4 +--- src/Exception/InvalidArgumentException.php | 5 ++--- src/Exception/OutOfBoundsException.php | 4 +--- src/Service/AbstractNavigationFactory.php | 4 ++-- 6 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/AbstractContainer.php b/src/AbstractContainer.php index de83f91..461ddb7 100644 --- a/src/AbstractContainer.php +++ b/src/AbstractContainer.php @@ -24,7 +24,7 @@ * @category Zend * @package Zend_Navigation */ -abstract class AbstractContainer implements RecursiveIterator, Countable +abstract class AbstractContainer implements Countable, RecursiveIterator { /** * Contains sub pages diff --git a/src/Exception/BadMethodCallException.php b/src/Exception/BadMethodCallException.php index fcfdfcc..0014fa3 100644 --- a/src/Exception/BadMethodCallException.php +++ b/src/Exception/BadMethodCallException.php @@ -17,7 +17,6 @@ * @package Zend_Navigation * @subpackage Exception */ -class BadMethodCallException - extends \BadMethodCallException - implements ExceptionInterface +class BadMethodCallException extends \BadMethodCallException implements + ExceptionInterface {} diff --git a/src/Exception/DomainException.php b/src/Exception/DomainException.php index eae5402..722c6b1 100644 --- a/src/Exception/DomainException.php +++ b/src/Exception/DomainException.php @@ -17,7 +17,5 @@ * @package Zend_Navigation * @subpackage Exception */ -class DomainException - extends \DomainException - implements ExceptionInterface +class DomainException extends \DomainException implements ExceptionInterface {} diff --git a/src/Exception/InvalidArgumentException.php b/src/Exception/InvalidArgumentException.php index fddd338..c3a56e4 100644 --- a/src/Exception/InvalidArgumentException.php +++ b/src/Exception/InvalidArgumentException.php @@ -17,7 +17,6 @@ * @package Zend_Navigation * @subpackage Exception */ -class InvalidArgumentException - extends \InvalidArgumentException - implements ExceptionInterface +class InvalidArgumentException extends \InvalidArgumentException implements + ExceptionInterface {} diff --git a/src/Exception/OutOfBoundsException.php b/src/Exception/OutOfBoundsException.php index e99c6b5..9d471a7 100644 --- a/src/Exception/OutOfBoundsException.php +++ b/src/Exception/OutOfBoundsException.php @@ -17,7 +17,5 @@ * @package Zend_Navigation * @subpackage Exception */ -class OutOfBoundsException - extends \OutOfBoundsException - implements ExceptionInterface +class OutOfBoundsException extends \OutOfBoundsException implements ExceptionInterface {} diff --git a/src/Service/AbstractNavigationFactory.php b/src/Service/AbstractNavigationFactory.php index 0f7eeb1..c8dca30 100644 --- a/src/Service/AbstractNavigationFactory.php +++ b/src/Service/AbstractNavigationFactory.php @@ -11,11 +11,11 @@ namespace Zend\Navigation\Service; use Zend\Config; +use Zend\Mvc\Router\RouteMatch; +use Zend\Mvc\Router\RouteStackInterface as Router; use Zend\Navigation\Exception; use Zend\Navigation\Navigation; use Zend\Navigation\Page\Mvc as MvcPage; -use Zend\Mvc\Router\RouteMatch; -use Zend\Mvc\Router\RouteStackInterface as Router; use Zend\ServiceManager\FactoryInterface; use Zend\ServiceManager\ServiceLocatorInterface;