From b91d92fb5a169a24a445b5681d814b5142f1eab1 Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Sun, 27 Apr 2014 14:22:52 +0200 Subject: [PATCH] cs cleanup and stop using deprecated Testing component document --- Admin/Extension/RouteReferrersExtension.php | 1 - Admin/RouteAdmin.php | 1 - CmfRoutingBundle.php | 3 +- Controller/RedirectController.php | 1 - DependencyInjection/CmfRoutingExtension.php | 2 - .../Compiler/SetRouterPass.php | 1 - DependencyInjection/Configuration.php | 1 - Doctrine/DoctrineProvider.php | 3 +- Doctrine/Orm/ContentRepository.php | 12 ++-- Doctrine/Orm/Route.php | 1 - Doctrine/Orm/RouteProvider.php | 1 - Doctrine/Phpcr/ContentRepository.php | 1 - Doctrine/Phpcr/IdPrefixListener.php | 1 - Doctrine/Phpcr/LocaleListener.php | 18 +++--- Doctrine/Phpcr/PrefixInterface.php | 3 +- Doctrine/Phpcr/RedirectRoute.php | 1 - Doctrine/Phpcr/Route.php | 1 - Doctrine/Phpcr/RouteProvider.php | 2 - Form/Type/RouteTypeType.php | 1 - Model/RedirectRoute.php | 3 +- Model/Route.php | 3 +- Routing/DynamicRouter.php | 1 - Tests/Functional/Admin/RouteAdminTest.php | 1 - Tests/Functional/BaseTestCase.php | 9 ++- .../Controller/RedirectControllerTest.php | 5 +- Tests/Functional/Doctrine/Orm/OrmTestCase.php | 2 - .../Doctrine/Orm/RouteProviderTest.php | 1 - .../Doctrine/Phpcr/RedirectRouteTest.php | 3 +- .../Doctrine/Phpcr/RouteProviderTest.php | 1 - Tests/Functional/Doctrine/Phpcr/RouteTest.php | 1 - .../Functional/Routing/DynamicRouterTest.php | 10 ++-- .../DataFixtures/Phpcr/LoadRouteData.php | 16 ++--- Tests/Resources/Document/Content.php | 60 ++++++++++++++++++- Tests/Resources/app/config/cmf_routing.yml | 2 +- .../Controller/RedirectControllerTest.php | 3 +- .../CmfRoutingExtensionTest.php | 4 +- .../Compiler/SetRouterPassTest.php | 3 +- .../DependencyInjection/ConfigurationTest.php | 3 +- .../DependencyInjection/XmlSchemaTest.php | 2 - .../Doctrine/Orm/ContentRepositoryTest.php | 1 - Tests/Unit/Doctrine/Orm/RouteProviderTest.php | 3 +- .../Doctrine/Phpcr/ContentRepositoryTest.php | 3 +- .../Doctrine/Phpcr/IdPrefixListenerTest.php | 3 +- .../Doctrine/Phpcr/LocaleListenerTest.php | 1 - .../Doctrine/Phpcr/PrefixCandidatesTest.php | 2 - .../Unit/Doctrine/Phpcr/RouteProviderTest.php | 1 - Tests/Unit/Doctrine/Phpcr/RouteTest.php | 1 - Tests/Unit/Form/Type/RouteTypeTypeTest.php | 3 +- Tests/Unit/Routing/DynamicRouterTest.php | 2 - Tests/WebTest/RedirectRouteAdminTest.php | 1 - Tests/WebTest/RouteAdminTest.php | 1 - 51 files changed, 102 insertions(+), 108 deletions(-) diff --git a/Admin/Extension/RouteReferrersExtension.php b/Admin/Extension/RouteReferrersExtension.php index a56878f4..3c2ae8ac 100644 --- a/Admin/Extension/RouteReferrersExtension.php +++ b/Admin/Extension/RouteReferrersExtension.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Admin\Extension; use Sonata\AdminBundle\Admin\AdminExtension; diff --git a/Admin/RouteAdmin.php b/Admin/RouteAdmin.php index 476ee7b7..4c353f12 100644 --- a/Admin/RouteAdmin.php +++ b/Admin/RouteAdmin.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Admin; use Sonata\AdminBundle\Datagrid\DatagridMapper; diff --git a/CmfRoutingBundle.php b/CmfRoutingBundle.php index 26f67c05..f71df1ce 100644 --- a/CmfRoutingBundle.php +++ b/CmfRoutingBundle.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle; use Doctrine\Bundle\PHPCRBundle\DependencyInjection\Compiler\DoctrinePhpcrMappingsPass; @@ -107,7 +106,7 @@ private function buildOrmCompilerPass(ContainerBuilder $container) * Otherwise use the standalone one from CmfCoreBundle. * * @return boolean|string the compiler pass to use or false if no suitable - * one was found + * one was found */ private function findDoctrineOrmCompiler() { diff --git a/Controller/RedirectController.php b/Controller/RedirectController.php index 51937e4f..2b59e83f 100644 --- a/Controller/RedirectController.php +++ b/Controller/RedirectController.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Controller; use Symfony\Component\Routing\RouterInterface; diff --git a/DependencyInjection/CmfRoutingExtension.php b/DependencyInjection/CmfRoutingExtension.php index 48495366..e46918da 100644 --- a/DependencyInjection/CmfRoutingExtension.php +++ b/DependencyInjection/CmfRoutingExtension.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\DependencyInjection; use Symfony\Component\HttpKernel\DependencyInjection\Extension; @@ -18,7 +17,6 @@ use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use Symfony\Component\Config\FileLocator; -use Symfony\Component\Config\Definition\Processor; use Symfony\Component\Config\Loader\LoaderInterface; /** diff --git a/DependencyInjection/Compiler/SetRouterPass.php b/DependencyInjection/Compiler/SetRouterPass.php index a3b7982d..a314775a 100644 --- a/DependencyInjection/Compiler/SetRouterPass.php +++ b/DependencyInjection/Compiler/SetRouterPass.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\ContainerBuilder; diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 28de6fe4..599df52e 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\DependencyInjection; use Symfony\Component\Config\Definition\ConfigurationInterface; diff --git a/Doctrine/DoctrineProvider.php b/Doctrine/DoctrineProvider.php index 72e058ca..1926b58a 100644 --- a/Doctrine/DoctrineProvider.php +++ b/Doctrine/DoctrineProvider.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Doctrine; use Doctrine\Common\Persistence\ManagerRegistry; @@ -53,7 +52,7 @@ abstract class DoctrineProvider /** * @param ManagerRegistry $managerRegistry - * @param string $className + * @param string $className */ public function __construct(ManagerRegistry $managerRegistry, $className = null) { diff --git a/Doctrine/Orm/ContentRepository.php b/Doctrine/Orm/ContentRepository.php index a7a4db56..6cca1fa8 100644 --- a/Doctrine/Orm/ContentRepository.php +++ b/Doctrine/Orm/ContentRepository.php @@ -9,14 +9,18 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm; use Symfony\Cmf\Component\Routing\ContentRepositoryInterface; use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\DoctrineProvider; /** - * Abstract content repository for ORM + * Abstract content repository for ORM. + * + * This repository follows the pattern of FQN:id. That is, the full model class + * name, then a colon, then the id. For example "Acme\Content:12". + * + * This will only work with single column ids. * * @author teito */ @@ -37,9 +41,7 @@ protected function getModelAndId($identifier) /** * {@inheritDoc} * - * @param string $id The ID contains both model name and id, seperated by a colon. - * The model name must not contain a colon. For instance, "Acme\Content:12" - * tries to find the Acme\Content object where id = 12 + * @param string $id The ID contains both model name and id, separated by a colon. */ public function findById($id) { diff --git a/Doctrine/Orm/Route.php b/Doctrine/Orm/Route.php index 4fb431df..6d6f8715 100644 --- a/Doctrine/Orm/Route.php +++ b/Doctrine/Orm/Route.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm; use Symfony\Cmf\Bundle\RoutingBundle\Model\Route as RouteModel; diff --git a/Doctrine/Orm/RouteProvider.php b/Doctrine/Orm/RouteProvider.php index 71ff9fb9..36a53b33 100644 --- a/Doctrine/Orm/RouteProvider.php +++ b/Doctrine/Orm/RouteProvider.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm; use Doctrine\Common\Persistence\ManagerRegistry; diff --git a/Doctrine/Phpcr/ContentRepository.php b/Doctrine/Phpcr/ContentRepository.php index 1c952ae7..ab08210c 100644 --- a/Doctrine/Phpcr/ContentRepository.php +++ b/Doctrine/Phpcr/ContentRepository.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr; use Symfony\Cmf\Component\Routing\ContentRepositoryInterface; diff --git a/Doctrine/Phpcr/IdPrefixListener.php b/Doctrine/Phpcr/IdPrefixListener.php index 75fae3aa..ba67d20a 100644 --- a/Doctrine/Phpcr/IdPrefixListener.php +++ b/Doctrine/Phpcr/IdPrefixListener.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr; use Doctrine\Common\Persistence\Event\LifecycleEventArgs; diff --git a/Doctrine/Phpcr/LocaleListener.php b/Doctrine/Phpcr/LocaleListener.php index b9907009..0323e2db 100644 --- a/Doctrine/Phpcr/LocaleListener.php +++ b/Doctrine/Phpcr/LocaleListener.php @@ -9,10 +9,8 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr; -use Doctrine\Common\Persistence\ManagerRegistry; use Doctrine\ODM\PHPCR\DocumentManager; use Doctrine\ODM\PHPCR\Event\MoveEventArgs; use Doctrine\Common\Persistence\Event\LifecycleEventArgs; @@ -166,14 +164,14 @@ protected function getPrefixes() * Update the locale of a route if $id starts with the prefix and has a * valid locale right after. * - * @param Route $doc The route object - * @param string $id The id (in move case, this is not the current - * id of $route). - * @param DocumentManager $dm The document manager to get locales from if - * the setAvailableTranslations option is - * enabled. - * @param boolean $force Whether to update the locale even if the - * route already has a locale. + * @param Route $doc The route object + * @param string $id The id (in move case, this is not the current + * id of $route). + * @param DocumentManager $dm The document manager to get locales from if + * the setAvailableTranslations option is + * enabled. + * @param boolean $force Whether to update the locale even if the + * route already has a locale. */ protected function updateLocale(Route $doc, $id, DocumentManager $dm, $force = false) { diff --git a/Doctrine/Phpcr/PrefixInterface.php b/Doctrine/Phpcr/PrefixInterface.php index a13aed2b..2a744ad4 100644 --- a/Doctrine/Phpcr/PrefixInterface.php +++ b/Doctrine/Phpcr/PrefixInterface.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr; /** @@ -27,7 +26,7 @@ public function getId(); /** * @param string $prefix The path in the repository to the routing root - * document. + * document. */ public function setPrefix($prefix); } diff --git a/Doctrine/Phpcr/RedirectRoute.php b/Doctrine/Phpcr/RedirectRoute.php index 0fd0fd1c..0df560f7 100644 --- a/Doctrine/Phpcr/RedirectRoute.php +++ b/Doctrine/Phpcr/RedirectRoute.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr; use Doctrine\Common\Collections\Collection; diff --git a/Doctrine/Phpcr/Route.php b/Doctrine/Phpcr/Route.php index cecb6207..70740a52 100644 --- a/Doctrine/Phpcr/Route.php +++ b/Doctrine/Phpcr/Route.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr; use Doctrine\Common\Collections\ArrayCollection; diff --git a/Doctrine/Phpcr/RouteProvider.php b/Doctrine/Phpcr/RouteProvider.php index 155e1e5c..00eb6bb6 100644 --- a/Doctrine/Phpcr/RouteProvider.php +++ b/Doctrine/Phpcr/RouteProvider.php @@ -11,8 +11,6 @@ namespace Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr; -use PHPCR\Query\QueryInterface; -use PHPCR\Query\RowInterface; use PHPCR\RepositoryException; use PHPCR\Util\UUIDHelper; use Doctrine\Common\Persistence\ManagerRegistry; diff --git a/Form/Type/RouteTypeType.php b/Form/Type/RouteTypeType.php index db3fe152..0cbdf76c 100644 --- a/Form/Type/RouteTypeType.php +++ b/Form/Type/RouteTypeType.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Form\Type; use Symfony\Component\Form\AbstractType; diff --git a/Model/RedirectRoute.php b/Model/RedirectRoute.php index 5ee911aa..b2cf1a68 100644 --- a/Model/RedirectRoute.php +++ b/Model/RedirectRoute.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Model; use LogicException; @@ -129,7 +128,7 @@ public function isPermanent() * and target route document. * * @param array $parameters a hashmap of key to value mapping for route - * parameters + * parameters */ public function setParameters(array $parameters) { diff --git a/Model/Route.php b/Model/Route.php index 259ef754..083881de 100644 --- a/Model/Route.php +++ b/Model/Route.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Model; use Symfony\Component\Routing\Route as SymfonyRoute; @@ -141,7 +140,7 @@ public function setStaticPrefix($prefix) * Set the object this url points to * * @param mixed $object A content object that can be persisted by the - * storage layer. + * storage layer. */ public function setContent($object) { diff --git a/Routing/DynamicRouter.php b/Routing/DynamicRouter.php index 17907fd8..c24cf9db 100644 --- a/Routing/DynamicRouter.php +++ b/Routing/DynamicRouter.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Routing; use Symfony\Component\HttpFoundation\Request; diff --git a/Tests/Functional/Admin/RouteAdminTest.php b/Tests/Functional/Admin/RouteAdminTest.php index 776969dd..11e8edda 100644 --- a/Tests/Functional/Admin/RouteAdminTest.php +++ b/Tests/Functional/Admin/RouteAdminTest.php @@ -13,7 +13,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Functional\Admin; use Symfony\Cmf\Bundle\RoutingBundle\Admin\RouteAdmin; diff --git a/Tests/Functional/BaseTestCase.php b/Tests/Functional/BaseTestCase.php index 49ad5639..38b1bf95 100644 --- a/Tests/Functional/BaseTestCase.php +++ b/Tests/Functional/BaseTestCase.php @@ -9,14 +9,13 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Functional; use Doctrine\ODM\PHPCR\DocumentManager; use PHPCR\Util\PathHelper; use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route; use Symfony\Cmf\Component\Testing\Functional\BaseTestCase as ComponentBaseTestCase; -use Symfony\Cmf\Component\Testing\Document\Content; +use Symfony\Cmf\Bundle\RoutingBundle\Tests\Resources\Document\Content; class BaseTestCase extends ComponentBaseTestCase { @@ -53,10 +52,10 @@ protected function createRoute($path) * * @return Content */ - protected function createContent($path) + protected function createContent($path = '/test/content') { - $content = new Content; - $content->setId('/test/content'); + $content = new Content(); + $content->setId($path); $content->setTitle('Foo Content'); $this->getDm()->persist($content); $this->getDm()->flush(); diff --git a/Tests/Functional/Controller/RedirectControllerTest.php b/Tests/Functional/Controller/RedirectControllerTest.php index 2df84b5d..a033cc79 100644 --- a/Tests/Functional/Controller/RedirectControllerTest.php +++ b/Tests/Functional/Controller/RedirectControllerTest.php @@ -9,11 +9,8 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Functional\Controller; -use Symfony\Component\HttpFoundation\RedirectResponse; - use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route; use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RedirectRoute; use Symfony\Cmf\Bundle\RoutingBundle\Controller\RedirectController; @@ -63,7 +60,7 @@ public function testRedirectUri() public function testRedirectContent() { - $content = $this->createContent('/test/content'); + $content = $this->createContent(); $root = $this->getDm()->find(null, self::ROUTE_ROOT); diff --git a/Tests/Functional/Doctrine/Orm/OrmTestCase.php b/Tests/Functional/Doctrine/Orm/OrmTestCase.php index 7e9c180c..72c27ab2 100644 --- a/Tests/Functional/Doctrine/Orm/OrmTestCase.php +++ b/Tests/Functional/Doctrine/Orm/OrmTestCase.php @@ -9,11 +9,9 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Functional\Doctrine\Orm; use Symfony\Cmf\Component\Testing\Functional\BaseTestCase as ComponentBaseTestCase; -use Symfony\Cmf\Component\Testing\Document\Content; use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm\Route; diff --git a/Tests/Functional/Doctrine/Orm/RouteProviderTest.php b/Tests/Functional/Doctrine/Orm/RouteProviderTest.php index 061a0bed..9d7adfcb 100644 --- a/Tests/Functional/Doctrine/Orm/RouteProviderTest.php +++ b/Tests/Functional/Doctrine/Orm/RouteProviderTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Functional\Doctrine\Orm; use Symfony\Component\HttpFoundation\Request; diff --git a/Tests/Functional/Doctrine/Phpcr/RedirectRouteTest.php b/Tests/Functional/Doctrine/Phpcr/RedirectRouteTest.php index a387994a..7acb3ec2 100644 --- a/Tests/Functional/Doctrine/Phpcr/RedirectRouteTest.php +++ b/Tests/Functional/Doctrine/Phpcr/RedirectRouteTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Functional\Doctrine\Phpcr; use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route; @@ -29,7 +28,7 @@ public function setUp() public function testRedirectDoctrine() { - $content = $this->createContent('/test/content'); + $content = $this->createContent(); $root = $this->getDm()->find(null, self::ROUTE_ROOT); $route = new Route; diff --git a/Tests/Functional/Doctrine/Phpcr/RouteProviderTest.php b/Tests/Functional/Doctrine/Phpcr/RouteProviderTest.php index b5795335..b470a27c 100644 --- a/Tests/Functional/Doctrine/Phpcr/RouteProviderTest.php +++ b/Tests/Functional/Doctrine/Phpcr/RouteProviderTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Functional\Doctrine\Phpcr; use Doctrine\ODM\PHPCR\Document\Generic; diff --git a/Tests/Functional/Doctrine/Phpcr/RouteTest.php b/Tests/Functional/Doctrine/Phpcr/RouteTest.php index 84c86da9..d2a8b65a 100644 --- a/Tests/Functional/Doctrine/Phpcr/RouteTest.php +++ b/Tests/Functional/Doctrine/Phpcr/RouteTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Functional\Doctrine\Phpcr; use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route; diff --git a/Tests/Functional/Routing/DynamicRouterTest.php b/Tests/Functional/Routing/DynamicRouterTest.php index fe333ee6..30525f29 100644 --- a/Tests/Functional/Routing/DynamicRouterTest.php +++ b/Tests/Functional/Routing/DynamicRouterTest.php @@ -9,20 +9,20 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Functional\Routing; use PHPCR\Util\NodeHelper; -use PHPCR\Util\PathHelper; use Symfony\Component\HttpFoundation\Request; +use Symfony\Cmf\Component\Routing\ChainRouter; +use Symfony\Cmf\Component\Routing\RouteObjectInterface; + use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route; use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RedirectRoute; use Symfony\Cmf\Bundle\RoutingBundle\Routing\DynamicRouter; -use Symfony\Cmf\Component\Routing\RouteObjectInterface; use Symfony\Cmf\Bundle\RoutingBundle\Tests\Functional\BaseTestCase; -use Symfony\Cmf\Component\Testing\Document\Content; +use Symfony\Cmf\Bundle\RoutingBundle\Tests\Resources\Document\Content; /** * The goal of these tests is to test the interoperation with DI and everything. @@ -32,7 +32,7 @@ class DynamicRouterTest extends BaseTestCase { /** - * @var \Symfony\Cmf\Component\Routing\ChainRouter + * @var ChainRouter */ protected $router; protected $routeNamePrefix; diff --git a/Tests/Resources/DataFixtures/Phpcr/LoadRouteData.php b/Tests/Resources/DataFixtures/Phpcr/LoadRouteData.php index d874498a..f040d928 100644 --- a/Tests/Resources/DataFixtures/Phpcr/LoadRouteData.php +++ b/Tests/Resources/DataFixtures/Phpcr/LoadRouteData.php @@ -9,27 +9,21 @@ * file that was distributed with this source code. */ - -namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Resources\DataFixtures\PHPCR; +namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Resources\DataFixtures\Phpcr; use Doctrine\Common\DataFixtures\FixtureInterface; use Doctrine\Common\Persistence\ObjectManager; -use Doctrine\Common\DataFixtures\DependentFixtureInterface; +use PHPCR\Util\NodeHelper; use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route; use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RedirectRoute; use Doctrine\ODM\PHPCR\Document\Generic; -class LoadRouteData implements FixtureInterface, DependentFixtureInterface +class LoadRouteData implements FixtureInterface { - public function getDependencies() - { - return array( - 'Symfony\Cmf\Component\Testing\DataFixtures\PHPCR\LoadBaseData', - ); - } - public function load(ObjectManager $manager) { + NodeHelper::createPath($manager->getPhpcrSession(), '/test'); + $root = $manager->find(null, '/test'); $parent = new Generic; $parent->setParent($root); diff --git a/Tests/Resources/Document/Content.php b/Tests/Resources/Document/Content.php index 26cebcbc..57696ed1 100644 --- a/Tests/Resources/Document/Content.php +++ b/Tests/Resources/Document/Content.php @@ -9,8 +9,7 @@ * file that was distributed with this source code. */ - -namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Functional\Testdoc; +namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Resources\Document; use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM; @@ -22,5 +21,60 @@ class Content /** * @PHPCRODM\Id */ - public $path; + private $id; + + /** + * @PHPCRODM\ParentDocument + */ + private $parent; + + /** + * @PHPCRODM\NodeName + */ + private $name; + + /** + * @PHPCRODM\String + */ + private $title; + + public function setId($id) + { + $this->id = $id; + } + + public function getId() + { + return $this->id; + } + + public function setParent($parent) + { + $this->parent = $parent; + } + + public function getParent() + { + return $this->parent; + } + + public function setName($name) + { + $this->name = $name; + } + + public function getName() + { + return $this->name; + } + + public function getTitle() + { + return $this->title; + } + + public function setTitle($title) + { + $this->title = $title; + } } diff --git a/Tests/Resources/app/config/cmf_routing.yml b/Tests/Resources/app/config/cmf_routing.yml index a6789aec..95ec6fcd 100644 --- a/Tests/Resources/app/config/cmf_routing.yml +++ b/Tests/Resources/app/config/cmf_routing.yml @@ -11,7 +11,7 @@ cmf_routing: controllers_by_class: Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\RedirectRoute: cmf_routing.redirect_controller:redirectAction templates_by_class: - Symfony\Cmf\Component\Testing\Document\Content: TestBundle:Content:index.html.twig + Symfony\Cmf\Bundle\RoutingBundle\Tests\Resources\Document\Content: TestBundle:Content:index.html.twig locales: - en - de diff --git a/Tests/Unit/Controller/RedirectControllerTest.php b/Tests/Unit/Controller/RedirectControllerTest.php index 60597004..27f42263 100644 --- a/Tests/Unit/Controller/RedirectControllerTest.php +++ b/Tests/Unit/Controller/RedirectControllerTest.php @@ -9,8 +9,7 @@ * file that was distributed with this source code. */ - -namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Controller; +namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Unit\Controller; use Symfony\Cmf\Bundle\RoutingBundle\Controller\RedirectController; diff --git a/Tests/Unit/DependencyInjection/CmfRoutingExtensionTest.php b/Tests/Unit/DependencyInjection/CmfRoutingExtensionTest.php index 7ea11538..af654b25 100644 --- a/Tests/Unit/DependencyInjection/CmfRoutingExtensionTest.php +++ b/Tests/Unit/DependencyInjection/CmfRoutingExtensionTest.php @@ -9,8 +9,7 @@ * file that was distributed with this source code. */ - -namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\DependencyInjection; +namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Unit\DependencyInjection; use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase; use Symfony\Cmf\Bundle\RoutingBundle\DependencyInjection\CmfRoutingExtension; @@ -138,7 +137,6 @@ public function testLoadBasePath() ), )); - $this->assertContainerBuilderHasParameter('cmf_routing.dynamic.persistence.phpcr.admin_basepath', '/cms/routes'); } diff --git a/Tests/Unit/DependencyInjection/Compiler/SetRouterPassTest.php b/Tests/Unit/DependencyInjection/Compiler/SetRouterPassTest.php index 0c74b162..8afe051b 100644 --- a/Tests/Unit/DependencyInjection/Compiler/SetRouterPassTest.php +++ b/Tests/Unit/DependencyInjection/Compiler/SetRouterPassTest.php @@ -9,8 +9,7 @@ * file that was distributed with this source code. */ - -namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\DependencyInjection\Compiler; +namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Unit\DependencyInjection\Compiler; use Symfony\Cmf\Bundle\RoutingBundle\DependencyInjection\Compiler\SetRouterPass; use Symfony\Component\DependencyInjection\ContainerBuilder; diff --git a/Tests/Unit/DependencyInjection/ConfigurationTest.php b/Tests/Unit/DependencyInjection/ConfigurationTest.php index 5fc8700a..7fa761cf 100644 --- a/Tests/Unit/DependencyInjection/ConfigurationTest.php +++ b/Tests/Unit/DependencyInjection/ConfigurationTest.php @@ -9,8 +9,7 @@ * file that was distributed with this source code. */ - -namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\DependencyInjection; +namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Unit\DependencyInjection; use Symfony\Cmf\Bundle\RoutingBundle\DependencyInjection\CmfRoutingExtension; use Symfony\Cmf\Bundle\RoutingBundle\DependencyInjection\Configuration; diff --git a/Tests/Unit/DependencyInjection/XmlSchemaTest.php b/Tests/Unit/DependencyInjection/XmlSchemaTest.php index e1441b56..28c0e6cb 100644 --- a/Tests/Unit/DependencyInjection/XmlSchemaTest.php +++ b/Tests/Unit/DependencyInjection/XmlSchemaTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Unit\DependencyInjection; use Symfony\Cmf\Component\Testing\Unit\XmlSchemaTestCase; @@ -46,4 +45,3 @@ public function testSchemaInvalidesTwoPersistenceLayers() $this->assertSchemaRefusesXml($this->fixturesPath.'config_invalid1.xml', $this->schemaPath); } } - diff --git a/Tests/Unit/Doctrine/Orm/ContentRepositoryTest.php b/Tests/Unit/Doctrine/Orm/ContentRepositoryTest.php index 2de02537..887f0e56 100644 --- a/Tests/Unit/Doctrine/Orm/ContentRepositoryTest.php +++ b/Tests/Unit/Doctrine/Orm/ContentRepositoryTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Unit\Doctrine\Orm; use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Orm\ContentRepository; diff --git a/Tests/Unit/Doctrine/Orm/RouteProviderTest.php b/Tests/Unit/Doctrine/Orm/RouteProviderTest.php index 16dc02f4..319b44e0 100644 --- a/Tests/Unit/Doctrine/Orm/RouteProviderTest.php +++ b/Tests/Unit/Doctrine/Orm/RouteProviderTest.php @@ -9,8 +9,7 @@ * file that was distributed with this source code. */ - -namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Doctrine\Orm; +namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Unit\Doctrine\Orm; use Doctrine\Common\Persistence\ManagerRegistry; use Doctrine\Common\Persistence\ObjectManager; diff --git a/Tests/Unit/Doctrine/Phpcr/ContentRepositoryTest.php b/Tests/Unit/Doctrine/Phpcr/ContentRepositoryTest.php index bfbcf77c..4139edc2 100644 --- a/Tests/Unit/Doctrine/Phpcr/ContentRepositoryTest.php +++ b/Tests/Unit/Doctrine/Phpcr/ContentRepositoryTest.php @@ -9,8 +9,7 @@ * file that was distributed with this source code. */ - -namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Doctrine\Phpcr; +namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Unit\Doctrine\Phpcr; use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\ContentRepository; diff --git a/Tests/Unit/Doctrine/Phpcr/IdPrefixListenerTest.php b/Tests/Unit/Doctrine/Phpcr/IdPrefixListenerTest.php index 187dd945..0022883d 100644 --- a/Tests/Unit/Doctrine/Phpcr/IdPrefixListenerTest.php +++ b/Tests/Unit/Doctrine/Phpcr/IdPrefixListenerTest.php @@ -9,8 +9,7 @@ * file that was distributed with this source code. */ - -namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Doctrine\Phpcr; +namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Unit\Doctrine\Phpcr; use Doctrine\Common\Persistence\Event\LifecycleEventArgs; use Doctrine\ODM\PHPCR\DocumentManager; diff --git a/Tests/Unit/Doctrine/Phpcr/LocaleListenerTest.php b/Tests/Unit/Doctrine/Phpcr/LocaleListenerTest.php index aa8a731f..81196475 100644 --- a/Tests/Unit/Doctrine/Phpcr/LocaleListenerTest.php +++ b/Tests/Unit/Doctrine/Phpcr/LocaleListenerTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Unit\Doctrine\Phpcr; use Doctrine\ODM\PHPCR\DocumentManager; diff --git a/Tests/Unit/Doctrine/Phpcr/PrefixCandidatesTest.php b/Tests/Unit/Doctrine/Phpcr/PrefixCandidatesTest.php index 6a48a906..f2c893a3 100644 --- a/Tests/Unit/Doctrine/Phpcr/PrefixCandidatesTest.php +++ b/Tests/Unit/Doctrine/Phpcr/PrefixCandidatesTest.php @@ -11,12 +11,10 @@ namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Unit\Doctrine\Phpcr; -use Doctrine\Common\Collections\ArrayCollection; use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\PrefixCandidates; use Symfony\Cmf\Component\Routing\Test\CmfUnitTestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; class PrefixCandidatesTest extends CmfUnitTestCase { diff --git a/Tests/Unit/Doctrine/Phpcr/RouteProviderTest.php b/Tests/Unit/Doctrine/Phpcr/RouteProviderTest.php index b6a9125c..7b04ac87 100644 --- a/Tests/Unit/Doctrine/Phpcr/RouteProviderTest.php +++ b/Tests/Unit/Doctrine/Phpcr/RouteProviderTest.php @@ -12,7 +12,6 @@ namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Unit\Doctrine\Phpcr; use PHPCR\Util\UUIDHelper; -use PHPCR\Query\QueryInterface; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Persistence\ManagerRegistry; use Doctrine\ODM\PHPCR\DocumentManager; diff --git a/Tests/Unit/Doctrine/Phpcr/RouteTest.php b/Tests/Unit/Doctrine/Phpcr/RouteTest.php index 97d53c15..410fe21a 100644 --- a/Tests/Unit/Doctrine/Phpcr/RouteTest.php +++ b/Tests/Unit/Doctrine/Phpcr/RouteTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Unit\Doctrine\Phpcr; use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route; diff --git a/Tests/Unit/Form/Type/RouteTypeTypeTest.php b/Tests/Unit/Form/Type/RouteTypeTypeTest.php index 0607af86..bb762fbb 100644 --- a/Tests/Unit/Form/Type/RouteTypeTypeTest.php +++ b/Tests/Unit/Form/Type/RouteTypeTypeTest.php @@ -9,8 +9,7 @@ * file that was distributed with this source code. */ - -namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Form\Type; +namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Unit\Form\Type; use Symfony\Cmf\Bundle\RoutingBundle\Form\Type\RouteTypeType; use Symfony\Component\OptionsResolver\OptionsResolver; diff --git a/Tests/Unit/Routing/DynamicRouterTest.php b/Tests/Unit/Routing/DynamicRouterTest.php index 5130fb78..7d65bb90 100644 --- a/Tests/Unit/Routing/DynamicRouterTest.php +++ b/Tests/Unit/Routing/DynamicRouterTest.php @@ -9,12 +9,10 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Unit\Routing; use Symfony\Cmf\Component\Routing\Event\Events; use Symfony\Cmf\Component\Routing\Event\RouterMatchEvent; -use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\Request; diff --git a/Tests/WebTest/RedirectRouteAdminTest.php b/Tests/WebTest/RedirectRouteAdminTest.php index 36048610..972d8616 100644 --- a/Tests/WebTest/RedirectRouteAdminTest.php +++ b/Tests/WebTest/RedirectRouteAdminTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\WebTest; use Symfony\Cmf\Component\Testing\Functional\BaseTestCase; diff --git a/Tests/WebTest/RouteAdminTest.php b/Tests/WebTest/RouteAdminTest.php index 67203f3b..77d8d2f4 100644 --- a/Tests/WebTest/RouteAdminTest.php +++ b/Tests/WebTest/RouteAdminTest.php @@ -9,7 +9,6 @@ * file that was distributed with this source code. */ - namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\WebTest; use Symfony\Cmf\Component\Testing\Functional\BaseTestCase;