Browse Source

[Doctrine] refactored unit tests

Fabien Potencier 13 năm trước cách đây
mục cha
commit
414d4be7e8

+ 1 - 1
tests/Symfony/Tests/Bridge/Doctrine/Form/DoctrineOrmTestCase.php

@@ -9,7 +9,7 @@
  * file that was distributed with this source code.
  */
 
-namespace Symfony\Tests\Bridge\Doctrine\Form;
+namespace Symfony\Tests\Bridge\Doctrine;
 
 use Symfony\Bridge\Doctrine\Annotations\IndexedReader;
 use Doctrine\Common\Annotations\AnnotationReader;

+ 1 - 1
tests/Symfony/Tests/Bridge/Doctrine/Fixtures/AssociationEntity.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace Symfony\Tests\Bridge\Doctrine\Form\Fixtures;
+namespace Symfony\Tests\Bridge\Doctrine\Fixtures;
 
 use Doctrine\ORM\Mapping AS ORM;
 

+ 1 - 1
tests/Symfony/Tests/Bridge/Doctrine/Fixtures/CompositeIdentEntity.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace Symfony\Tests\Bridge\Doctrine\Form\Fixtures;
+namespace Symfony\Tests\Bridge\Doctrine\Fixtures;
 
 use Doctrine\ORM\Mapping\Id;
 use Doctrine\ORM\Mapping\Column;

+ 1 - 1
tests/Symfony/Tests/Bridge/Doctrine/Fixtures/CompositeStringIdentEntity.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace Symfony\Tests\Bridge\Doctrine\Form\Fixtures;
+namespace Symfony\Tests\Bridge\Doctrine\Fixtures;
 
 use Doctrine\ORM\Mapping\Id;
 use Doctrine\ORM\Mapping\Column;

+ 1 - 1
tests/Symfony/Tests/Bridge/Doctrine/Fixtures/SingleIdentEntity.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace Symfony\Tests\Bridge\Doctrine\Form\Fixtures;
+namespace Symfony\Tests\Bridge\Doctrine\Fixtures;
 
 use Doctrine\ORM\Mapping\Id;
 use Doctrine\ORM\Mapping\Column;

+ 1 - 1
tests/Symfony/Tests/Bridge/Doctrine/Fixtures/SingleStringIdentEntity.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace Symfony\Tests\Bridge\Doctrine\Form\Fixtures;
+namespace Symfony\Tests\Bridge\Doctrine\Fixtures;
 
 use Doctrine\ORM\Mapping\Id;
 use Doctrine\ORM\Mapping\Column;

+ 5 - 5
tests/Symfony/Tests/Bridge/Doctrine/Form/ChoiceList/EntityChoiceListTest.php

@@ -11,18 +11,18 @@
 
 namespace Symfony\Tests\Bridge\Doctrine\Form\ChoiceList;
 
-require_once __DIR__.'/../DoctrineOrmTestCase.php';
+require_once __DIR__.'/../../DoctrineOrmTestCase.php';
 require_once __DIR__.'/../../Fixtures/SingleIdentEntity.php';
 
-use Symfony\Tests\Bridge\Doctrine\Form\DoctrineOrmTestCase;
-use Symfony\Tests\Bridge\Doctrine\Form\Fixtures\SingleIdentEntity;
+use Symfony\Tests\Bridge\Doctrine\DoctrineOrmTestCase;
+use Symfony\Tests\Bridge\Doctrine\Fixtures\SingleIdentEntity;
 use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList;
 
 class EntityChoiceListTest extends DoctrineOrmTestCase
 {
-    const SINGLE_IDENT_CLASS = 'Symfony\Tests\Bridge\Doctrine\Form\Fixtures\SingleIdentEntity';
+    const SINGLE_IDENT_CLASS = 'Symfony\Tests\Bridge\Doctrine\Fixtures\SingleIdentEntity';
 
-    const COMPOSITE_IDENT_CLASS = 'Symfony\Tests\Bridge\Doctrine\Form\Fixtures\CompositeIdentEntity';
+    const COMPOSITE_IDENT_CLASS = 'Symfony\Tests\Bridge\Doctrine\Fixtures\CompositeIdentEntity';
 
     private $em;
 

+ 10 - 10
tests/Symfony/Tests/Bridge/Doctrine/Form/Type/EntityTypeTest.php

@@ -11,7 +11,7 @@
 
 namespace Symfony\Tests\Bridge\Doctrine\Form\Type;
 
-require_once __DIR__.'/../DoctrineOrmTestCase.php';
+require_once __DIR__.'/../../DoctrineOrmTestCase.php';
 require_once __DIR__.'/../../Fixtures/SingleIdentEntity.php';
 require_once __DIR__.'/../../Fixtures/SingleStringIdentEntity.php';
 require_once __DIR__.'/../../Fixtures/CompositeIdentEntity.php';
@@ -19,11 +19,11 @@ require_once __DIR__.'/../../Fixtures/CompositeStringIdentEntity.php';
 
 use Symfony\Component\Form\Exception\UnexpectedTypeException;
 use Symfony\Tests\Component\Form\Extension\Core\Type\TypeTestCase;
-use Symfony\Tests\Bridge\Doctrine\Form\DoctrineOrmTestCase;
-use Symfony\Tests\Bridge\Doctrine\Form\Fixtures\SingleIdentEntity;
-use Symfony\Tests\Bridge\Doctrine\Form\Fixtures\SingleStringIdentEntity;
-use Symfony\Tests\Bridge\Doctrine\Form\Fixtures\CompositeIdentEntity;
-use Symfony\Tests\Bridge\Doctrine\Form\Fixtures\CompositeStringIdentEntity;
+use Symfony\Tests\Bridge\Doctrine\DoctrineOrmTestCase;
+use Symfony\Tests\Bridge\Doctrine\Fixtures\SingleIdentEntity;
+use Symfony\Tests\Bridge\Doctrine\Fixtures\SingleStringIdentEntity;
+use Symfony\Tests\Bridge\Doctrine\Fixtures\CompositeIdentEntity;
+use Symfony\Tests\Bridge\Doctrine\Fixtures\CompositeStringIdentEntity;
 use Symfony\Bridge\Doctrine\Form\DoctrineOrmExtension;
 use Doctrine\ORM\Tools\SchemaTool;
 use Doctrine\ORM\EntityManager;
@@ -31,10 +31,10 @@ use Doctrine\Common\Collections\ArrayCollection;
 
 class EntityTypeTest extends TypeTestCase
 {
-    const SINGLE_IDENT_CLASS = 'Symfony\Tests\Bridge\Doctrine\Form\Fixtures\SingleIdentEntity';
-    const SINGLE_STRING_IDENT_CLASS = 'Symfony\Tests\Bridge\Doctrine\Form\Fixtures\SingleStringIdentEntity';
-    const COMPOSITE_IDENT_CLASS = 'Symfony\Tests\Bridge\Doctrine\Form\Fixtures\CompositeIdentEntity';
-    const COMPOSITE_STRING_IDENT_CLASS = 'Symfony\Tests\Bridge\Doctrine\Form\Fixtures\CompositeStringIdentEntity';
+    const SINGLE_IDENT_CLASS = 'Symfony\Tests\Bridge\Doctrine\Fixtures\SingleIdentEntity';
+    const SINGLE_STRING_IDENT_CLASS = 'Symfony\Tests\Bridge\Doctrine\Fixtures\SingleStringIdentEntity';
+    const COMPOSITE_IDENT_CLASS = 'Symfony\Tests\Bridge\Doctrine\Fixtures\CompositeIdentEntity';
+    const COMPOSITE_STRING_IDENT_CLASS = 'Symfony\Tests\Bridge\Doctrine\Fixtures\CompositeStringIdentEntity';
 
     private $em;
 

+ 11 - 11
tests/Symfony/Tests/Bridge/Doctrine/Validator/Constraints/UniqueValidatorTest.php

@@ -11,15 +11,15 @@
 
 namespace Symfony\Tests\Bridge\Doctrine\Validator\Constraints;
 
-require_once __DIR__.'/../../Form/DoctrineOrmTestCase.php';
+require_once __DIR__.'/../../DoctrineOrmTestCase.php';
 require_once __DIR__.'/../../Fixtures/SingleIdentEntity.php';
 require_once __DIR__.'/../../Fixtures/CompositeIdentEntity.php';
 require_once __DIR__.'/../../Fixtures/AssociationEntity.php';
 
-use Symfony\Tests\Bridge\Doctrine\Form\DoctrineOrmTestCase;
-use Symfony\Tests\Bridge\Doctrine\Form\Fixtures\SingleIdentEntity;
-use Symfony\Tests\Bridge\Doctrine\Form\Fixtures\CompositeIdentEntity;
-use Symfony\Tests\Bridge\Doctrine\Form\Fixtures\AssociationEntity;
+use Symfony\Tests\Bridge\Doctrine\DoctrineOrmTestCase;
+use Symfony\Tests\Bridge\Doctrine\Fixtures\SingleIdentEntity;
+use Symfony\Tests\Bridge\Doctrine\Fixtures\CompositeIdentEntity;
+use Symfony\Tests\Bridge\Doctrine\Fixtures\AssociationEntity;
 use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
 use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntityValidator;
 use Symfony\Component\Validator\Mapping\ClassMetadata;
@@ -64,7 +64,7 @@ class UniqueValidatorTest extends DoctrineOrmTestCase
     public function createValidator($entityManagerName, $em, $validateClass = null, $uniqueFields = null)
     {
         if (!$validateClass) {
-            $validateClass = 'Symfony\Tests\Bridge\Doctrine\Form\Fixtures\SingleIdentEntity';
+            $validateClass = 'Symfony\Tests\Bridge\Doctrine\Fixtures\SingleIdentEntity';
         }
         if (!$uniqueFields) {
             $uniqueFields = array('name');
@@ -87,9 +87,9 @@ class UniqueValidatorTest extends DoctrineOrmTestCase
     {
         $schemaTool = new SchemaTool($em);
         $schemaTool->createSchema(array(
-            $em->getClassMetadata('Symfony\Tests\Bridge\Doctrine\Form\Fixtures\SingleIdentEntity'),
-            $em->getClassMetadata('Symfony\Tests\Bridge\Doctrine\Form\Fixtures\CompositeIdentEntity'),
-            $em->getClassMetadata('Symfony\Tests\Bridge\Doctrine\Form\Fixtures\AssociationEntity'),
+            $em->getClassMetadata('Symfony\Tests\Bridge\Doctrine\Fixtures\SingleIdentEntity'),
+            $em->getClassMetadata('Symfony\Tests\Bridge\Doctrine\Fixtures\CompositeIdentEntity'),
+            $em->getClassMetadata('Symfony\Tests\Bridge\Doctrine\Fixtures\AssociationEntity'),
         ));
     }
 
@@ -171,7 +171,7 @@ class UniqueValidatorTest extends DoctrineOrmTestCase
         $entityManagerName = "foo";
         $em = $this->createTestEntityManager();
         $this->createSchema($em);
-        $validator = $this->createValidator($entityManagerName, $em, 'Symfony\Tests\Bridge\Doctrine\Form\Fixtures\AssociationEntity', array('single'));
+        $validator = $this->createValidator($entityManagerName, $em, 'Symfony\Tests\Bridge\Doctrine\Fixtures\AssociationEntity', array('single'));
 
         $entity1 = new SingleIdentEntity(1, 'foo');
         $associated = new AssociationEntity();
@@ -202,7 +202,7 @@ class UniqueValidatorTest extends DoctrineOrmTestCase
         $entityManagerName = "foo";
         $em = $this->createTestEntityManager();
         $this->createSchema($em);
-        $validator = $this->createValidator($entityManagerName, $em, 'Symfony\Tests\Bridge\Doctrine\Form\Fixtures\AssociationEntity', array('composite'));
+        $validator = $this->createValidator($entityManagerName, $em, 'Symfony\Tests\Bridge\Doctrine\Fixtures\AssociationEntity', array('composite'));
 
         $composite = new CompositeIdentEntity(1, 1, "test");
         $associated = new AssociationEntity();