Procházet zdrojové kódy

[tests] changes for test cases

gediminasm před 14 roky
rodič
revize
d5985b6d12

+ 1 - 1
lib/Gedmo/Translatable/Mapping/Event/Adapter/ODM.php

@@ -109,7 +109,7 @@ final class ODM extends BaseAdapterODM implements TranslatableAdapter
         }
     }
 
-	/**
+    /**
      * {@inheritDoc}
      */
     public function getTranslationValue($object, $field)

+ 24 - 0
tests/Gedmo/Tool/BaseTestCaseORM.php

@@ -73,6 +73,30 @@ abstract class BaseTestCaseORM extends \PHPUnit_Framework_TestCase
         return $this->em = $em;
     }
 
+    /**
+     * EntityManager mock object together with
+     * annotation mapping driver and custom
+     * connection
+     *
+     * @param array $conn
+     * @param EventManager $evm
+     * @return EntityManager
+     */
+    protected function getMockCustomEntityManager(array $conn, EventManager $evm = null)
+    {
+        $config = $this->getMockAnnotatedConfig();
+        $em = EntityManager::create($conn, $config, $evm ?: $this->getEventManager());
+
+        $schema = array_map(function($class) use ($em) {
+            return $em->getClassMetadata($class);
+        }, (array)$this->getUsedEntityFixtures());
+
+        $schemaTool = new SchemaTool($em);
+        $schemaTool->dropSchema(array());
+        $schemaTool->createSchema($schema);
+        return $this->em = $em;
+    }
+
     /**
      * EntityManager mock object with
      * annotation mapping driver

+ 9 - 2
tests/phpunit.dist.xml

@@ -8,7 +8,14 @@
             <directory suffix=".php">./Gedmo/Sluggable/</directory>
         </testsuite>
         <testsuite name="Tree Extension">
-            <directory suffix=".php">./Gedmo/Tree/</directory>
+            <file>./Gedmo/Tree/ConcurrencyTest.php</file>
+            <file>./Gedmo/Tree/MultiInheritanceTest.php</file>
+            <file>./Gedmo/Tree/MultiInheritanceTest2.php</file>
+            <file>./Gedmo/Tree/NestedTreeRootRepositoryTest.php</file>
+            <file>./Gedmo/Tree/NestedTreeRootTest.php</file>
+            <file>./Gedmo/Tree/RepositoryTest.php</file>
+            <file>./Gedmo/Tree/TranslatableSluggableTreeTest.php</file>
+            <file>./Gedmo/Tree/TreeTest.php</file>
         </testsuite>
         <testsuite name="Timestampable Extension">
             <directory suffix=".php">./Gedmo/Timestampable/</directory>
@@ -20,4 +27,4 @@
             <directory suffix=".php">./Gedmo/Loggable/</directory>
         </testsuite>
     </testsuites>
-</phpunit>
+</phpunit>