Преглед на файлове

1 optimized the translatable to avoid unnecessary queries. 2 updated yaml mapping for translatable. 3 updated unit test fixture autoloaders

gediminasm преди 14 години
родител
ревизия
5f75c7ddb7
променени са 25 файла, в които са добавени 69 реда и са изтрити 99 реда
  1. 6 6
      lib/Gedmo/Translatable/Mapping/Driver/Yaml.php
  2. 17 7
      lib/Gedmo/Translatable/TranslationListener.php
  3. 6 8
      lib/Gedmo/Tree/Mapping/Driver/Yaml.php
  4. 3 3
      tests/Gedmo/Mapping/Driver/Yaml/Mapping.Fixture.Yaml.BaseCategory.dcm.yml
  5. 2 2
      tests/Gedmo/Mapping/Driver/Yaml/Mapping.Fixture.Yaml.Category.dcm.yml
  6. 1 1
      tests/Gedmo/Mapping/Driver/Yaml/Mapping.Fixture.Yaml.User.dcm.yml
  7. 1 4
      tests/Gedmo/Mapping/SluggableMappingTest.php
  8. 1 4
      tests/Gedmo/Mapping/TimestampableMappingTest.php
  9. 1 4
      tests/Gedmo/Mapping/TranslatableMappingTest.php
  10. 1 4
      tests/Gedmo/Mapping/TreeMappingTest.php
  11. 1 4
      tests/Gedmo/Sluggable/SluggableConfigurationTest.php
  12. 1 4
      tests/Gedmo/Sluggable/SluggableTest.php
  13. 1 4
      tests/Gedmo/Timestampable/NoInterfaceTest.php
  14. 1 4
      tests/Gedmo/Timestampable/ProtectedPropertySupperclassTest.php
  15. 1 4
      tests/Gedmo/Timestampable/TimestampableTest.php
  16. 1 4
      tests/Gedmo/Translatable/EntityTranslationTableTest.php
  17. 1 4
      tests/Gedmo/Translatable/InheritanceTest.php
  18. 1 4
      tests/Gedmo/Translatable/TranslatableIdentifierTest.php
  19. 1 4
      tests/Gedmo/Translatable/TranslatableTest.php
  20. 1 4
      tests/Gedmo/Tree/ConcurrencyTest.php
  21. 1 4
      tests/Gedmo/Tree/MultiInheritanceTest.php
  22. 1 4
      tests/Gedmo/Tree/RepositoryTest.php
  23. 1 4
      tests/Gedmo/Tree/TranslatableSluggableTreeTest.php
  24. 1 4
      tests/Gedmo/Tree/TreeTest.php
  25. 16 0
      tests/bootstrap.php

+ 6 - 6
lib/Gedmo/Translatable/Mapping/Driver/Yaml.php

@@ -58,17 +58,17 @@ class Yaml extends File implements Driver
         
         
         if (isset($mapping['gedmo'])) {
         if (isset($mapping['gedmo'])) {
             $classMapping = $mapping['gedmo'];
             $classMapping = $mapping['gedmo'];
-            if (isset($classMapping['translatable']['entity'])) {
-                $translationEntity = $classMapping['translatable']['entity'];
+            if (isset($classMapping['translation']['entity'])) {
+                $translationEntity = $classMapping['translation']['entity'];
                 if (!class_exists($translationEntity)) {
                 if (!class_exists($translationEntity)) {
                     throw MappingException::translationClassNotFound($translationEntity);
                     throw MappingException::translationClassNotFound($translationEntity);
                 }
                 }
                 $config['translationClass'] = $translationEntity;
                 $config['translationClass'] = $translationEntity;
             }
             }
-            if (isset($classMapping['translatable']['locale'])) {
-                $config['locale'] = $classMapping['translatable']['locale'];
-            } elseif (isset($classMapping['translatable']['language'])) {
-                $config['locale'] = $classMapping['translatable']['language'];
+            if (isset($classMapping['translation']['locale'])) {
+                $config['locale'] = $classMapping['translation']['locale'];
+            } elseif (isset($classMapping['translation']['language'])) {
+                $config['locale'] = $classMapping['translation']['language'];
             }
             }
         }
         }
         if (isset($mapping['fields'])) {
         if (isset($mapping['fields'])) {

+ 17 - 7
lib/Gedmo/Translatable/TranslationListener.php

@@ -389,8 +389,12 @@ class TranslationListener implements EventSubscriber
                 foreach ((array)$result as $entry) {
                 foreach ((array)$result as $entry) {
                     if ($entry['field'] == $field && strlen($entry['content'])) {
                     if ($entry['field'] == $field && strlen($entry['content'])) {
                         // update translation only if it has it
                         // update translation only if it has it
-                        $meta->getReflectionProperty($field)
-                            ->setValue($entity, $entry['content']);
+                        $meta->getReflectionProperty($field)->setValue($entity, $entry['content']);
+                        $em->getUnitOfWork()->setOriginalEntityProperty(
+                            spl_object_hash($entity), 
+                            $field, 
+                            $entry['content']
+                        );
                     }
                     }
                 }
                 }
             }    
             }    
@@ -478,18 +482,24 @@ class TranslationListener implements EventSubscriber
         // check if we have default translation and need to reset the translation
         // check if we have default translation and need to reset the translation
         if (!$isInsert && strlen($this->_defaultLocale)) {
         if (!$isInsert && strlen($this->_defaultLocale)) {
             $this->_validateLocale($this->_defaultLocale);
             $this->_validateLocale($this->_defaultLocale);
-            $changeSet = $uow->getEntityChangeSet($entity);
-            $needsUpdate = false;
+            $changeSet = $modifiedChangeSet = $uow->getEntityChangeSet($entity);
             foreach ($changeSet as $field => $changes) {
             foreach ($changeSet as $field => $changes) {
                 if (in_array($field, $translatableFields)) {
                 if (in_array($field, $translatableFields)) {
                     if ($locale != $this->_defaultLocale && strlen($changes[0])) {
                     if ($locale != $this->_defaultLocale && strlen($changes[0])) {
                         $meta->getReflectionProperty($field)->setValue($entity, $changes[0]);
                         $meta->getReflectionProperty($field)->setValue($entity, $changes[0]);
-                        $needsUpdate = true;
+                        $uow->setOriginalEntityProperty(spl_object_hash($entity), $field, $changes[0]);
+                        unset($modifiedChangeSet[$field]);
                     }
                     }
                 }
                 }
             }
             }
-            if ($needsUpdate) {
-                $uow->recomputeSingleEntityChangeSet($meta, $entity);
+            // cleanup current changeset
+            $uow->clearEntityChangeSet(spl_object_hash($entity));
+            // recompute changeset only if there are changes other than reverted translations
+            if ($modifiedChangeSet) {
+                foreach ($modifiedChangeSet as $field => $changes) {
+                    $uow->setOriginalEntityProperty(spl_object_hash($entity), $field, $changes[0]);
+                }
+                $uow->computeChangeSet($meta, $entity);
             }
             }
         }
         }
     }
     }

+ 6 - 8
lib/Gedmo/Tree/Mapping/Driver/Yaml.php

@@ -70,19 +70,18 @@ class Yaml extends File implements Driver
         $mapping = $yaml[$meta->name];
         $mapping = $yaml[$meta->name];
         if (isset($mapping['fields'])) {
         if (isset($mapping['fields'])) {
             foreach ($mapping['fields'] as $field => $fieldMapping) {
             foreach ($mapping['fields'] as $field => $fieldMapping) {
-                if (isset($fieldMapping['gedmo']['tree'])) {
-                    $mappingProperty = $fieldMapping['gedmo']['tree'];
-                    if ($mappingProperty == 'left') {
+                if (isset($fieldMapping['gedmo'])) {
+                    if (in_array('treeLeft', $fieldMapping['gedmo'])) {
                         if (!$this->_isValidField($meta, $field)) {
                         if (!$this->_isValidField($meta, $field)) {
                             throw MappingException::notValidFieldType($field, $meta->name);
                             throw MappingException::notValidFieldType($field, $meta->name);
                         }
                         }
                         $config['left'] = $field;
                         $config['left'] = $field;
-                    } elseif ($mappingProperty == 'right') {
+                    } elseif (in_array('treeRight', $fieldMapping['gedmo'])) {
                         if (!$this->_isValidField($meta, $field)) {
                         if (!$this->_isValidField($meta, $field)) {
                             throw MappingException::notValidFieldType($field, $meta->name);
                             throw MappingException::notValidFieldType($field, $meta->name);
                         }
                         }
                         $config['right'] = $field;
                         $config['right'] = $field;
-                    } elseif ($mappingProperty == 'level') {
+                    } elseif (in_array('treeLevel', $fieldMapping['gedmo'])) {
                         if (!$this->_isValidField($meta, $field)) {
                         if (!$this->_isValidField($meta, $field)) {
                             throw MappingException::notValidFieldType($field, $meta->name);
                             throw MappingException::notValidFieldType($field, $meta->name);
                         }
                         }
@@ -93,9 +92,8 @@ class Yaml extends File implements Driver
         }
         }
         if (isset($mapping['manyToOne'])) {
         if (isset($mapping['manyToOne'])) {
             foreach ($mapping['manyToOne'] as $field => $relationMapping) {
             foreach ($mapping['manyToOne'] as $field => $relationMapping) {
-                if (isset($relationMapping['gedmo']['tree'])) {
-                    $mappingProperty = $relationMapping['gedmo']['tree'];
-                    if ($mappingProperty == 'parent') {
+                if (isset($relationMapping['gedmo'])) {
+                    if (in_array('treeParent', $relationMapping['gedmo'])) {
                         if ($relationMapping['targetEntity'] != $meta->name) {
                         if ($relationMapping['targetEntity'] != $meta->name) {
                             throw MappingException::parentFieldNotMappedOrRelated($field, $meta->name);
                             throw MappingException::parentFieldNotMappedOrRelated($field, $meta->name);
                         }
                         }

+ 3 - 3
tests/Gedmo/Mapping/Driver/Yaml/Mapping.Fixture.Yaml.BaseCategory.dcm.yml

@@ -5,15 +5,15 @@ Mapping\Fixture\Yaml\BaseCategory:
     lft:
     lft:
       type: integer
       type: integer
       gedmo:
       gedmo:
-        tree: left
+        - treeLeft
     rgt:
     rgt:
       type: integer
       type: integer
       gedmo:
       gedmo:
-        tree: right
+        - treeRight
     lvl:
     lvl:
       type: integer
       type: integer
       gedmo:
       gedmo:
-        tree: level
+        - treeLevel
     created:
     created:
       type: datetime
       type: datetime
       gedmo:
       gedmo:

+ 2 - 2
tests/Gedmo/Mapping/Driver/Yaml/Mapping.Fixture.Yaml.Category.dcm.yml

@@ -8,7 +8,7 @@ Mapping\Fixture\Yaml\Category:
       generator:
       generator:
         strategy: AUTO
         strategy: AUTO
   gedmo:
   gedmo:
-    translatable:
+    translation:
       entity: Translatable\Fixture\CategoryTranslation
       entity: Translatable\Fixture\CategoryTranslation
       locale: localeField
       locale: localeField
   fields:
   fields:
@@ -38,7 +38,7 @@ Mapping\Fixture\Yaml\Category:
       targetEntity: Mapping\Fixture\Yaml\Category
       targetEntity: Mapping\Fixture\Yaml\Category
       inversedBy: children
       inversedBy: children
       gedmo:
       gedmo:
-        tree: parent
+        - treeParent
   oneToMany:
   oneToMany:
     children:
     children:
       targetEntity: Mapping\Fixture\Yaml\Category
       targetEntity: Mapping\Fixture\Yaml\Category

+ 1 - 1
tests/Gedmo/Mapping/Driver/Yaml/Mapping.Fixture.Yaml.User.dcm.yml

@@ -2,7 +2,7 @@
 Mapping\Fixture\Yaml\User:
 Mapping\Fixture\Yaml\User:
   type: entity
   type: entity
   gedmo:
   gedmo:
-    translatable:
+    translation:
       entity: Translatable\Fixture\PersonTranslation
       entity: Translatable\Fixture\PersonTranslation
       locale: localeField
       locale: localeField
   table: users
   table: users

+ 1 - 4
tests/Gedmo/Mapping/SluggableMappingTest.php

@@ -22,10 +22,7 @@ class SluggableMappingTest extends \PHPUnit_Framework_TestCase
     private $em;
     private $em;
 
 
     public function setUp()
     public function setUp()
-    {
-        $classLoader = new \Doctrine\Common\ClassLoader('Mapping\Fixture', __DIR__ . '/../');
-        $classLoader->register();
-        
+    {        
         $config = new \Doctrine\ORM\Configuration();
         $config = new \Doctrine\ORM\Configuration();
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);

+ 1 - 4
tests/Gedmo/Mapping/TimestampableMappingTest.php

@@ -22,10 +22,7 @@ class TimestampableMappingTest extends \PHPUnit_Framework_TestCase
     private $em;
     private $em;
 
 
     public function setUp()
     public function setUp()
-    {
-        $classLoader = new \Doctrine\Common\ClassLoader('Mapping\Fixture', __DIR__ . '/../');
-        $classLoader->register();
-        
+    {        
         $config = new \Doctrine\ORM\Configuration();
         $config = new \Doctrine\ORM\Configuration();
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);

+ 1 - 4
tests/Gedmo/Mapping/TranslatableMappingTest.php

@@ -22,10 +22,7 @@ class TranslatableMappingTest extends \PHPUnit_Framework_TestCase
     private $em;
     private $em;
 
 
     public function setUp()
     public function setUp()
-    {
-        $classLoader = new \Doctrine\Common\ClassLoader('Mapping\Fixture', __DIR__ . '/../');
-        $classLoader->register();
-        
+    {        
         $config = new \Doctrine\ORM\Configuration();
         $config = new \Doctrine\ORM\Configuration();
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);

+ 1 - 4
tests/Gedmo/Mapping/TreeMappingTest.php

@@ -22,10 +22,7 @@ class TreeMappingTest extends \PHPUnit_Framework_TestCase
     private $em;
     private $em;
 
 
     public function setUp()
     public function setUp()
-    {
-        $classLoader = new \Doctrine\Common\ClassLoader('Mapping\Fixture', __DIR__ . '/../');
-        $classLoader->register();
-        
+    {        
         $config = new \Doctrine\ORM\Configuration();
         $config = new \Doctrine\ORM\Configuration();
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);

+ 1 - 4
tests/Gedmo/Sluggable/SluggableConfigurationTest.php

@@ -21,10 +21,7 @@ class SluggableConfigurationTest extends \PHPUnit_Framework_TestCase
     private $em;
     private $em;
 
 
     public function setUp()
     public function setUp()
-    {
-        $classLoader = new \Doctrine\Common\ClassLoader('Sluggable\Fixture', __DIR__ . '/../');
-        $classLoader->register();
-        
+    {        
         $config = new \Doctrine\ORM\Configuration();
         $config = new \Doctrine\ORM\Configuration();
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);

+ 1 - 4
tests/Gedmo/Sluggable/SluggableTest.php

@@ -24,10 +24,7 @@ class SluggableTest extends \PHPUnit_Framework_TestCase
     private $em;
     private $em;
 
 
     public function setUp()
     public function setUp()
-    {
-        $classLoader = new \Doctrine\Common\ClassLoader('Sluggable\Fixture', __DIR__ . '/../');
-        $classLoader->register();
-        
+    {        
         $config = new \Doctrine\ORM\Configuration();
         $config = new \Doctrine\ORM\Configuration();
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);

+ 1 - 4
tests/Gedmo/Timestampable/NoInterfaceTest.php

@@ -19,10 +19,7 @@ class NoInterfaceTest extends \PHPUnit_Framework_TestCase
     private $em;
     private $em;
 
 
     public function setUp()
     public function setUp()
-    {
-        $classLoader = new \Doctrine\Common\ClassLoader('Timestampable\Fixture', __DIR__ . '/../');
-        $classLoader->register();
-        
+    {        
         $config = new \Doctrine\ORM\Configuration();
         $config = new \Doctrine\ORM\Configuration();
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);

+ 1 - 4
tests/Gedmo/Timestampable/ProtectedPropertySupperclassTest.php

@@ -19,10 +19,7 @@ class ProtectedPropertySupperclassTest extends \PHPUnit_Framework_TestCase
     private $em;
     private $em;
 
 
     public function setUp()
     public function setUp()
-    {
-        $classLoader = new \Doctrine\Common\ClassLoader('Timestampable\Fixture', __DIR__ . '/../');
-        $classLoader->register();
-        
+    {        
         $config = new \Doctrine\ORM\Configuration();
         $config = new \Doctrine\ORM\Configuration();
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);

+ 1 - 4
tests/Gedmo/Timestampable/TimestampableTest.php

@@ -23,10 +23,7 @@ class TimestampableTest extends \PHPUnit_Framework_TestCase
     private $em;
     private $em;
 
 
     public function setUp()
     public function setUp()
-    {
-        $classLoader = new \Doctrine\Common\ClassLoader('Timestampable\Fixture', __DIR__ . '/../');
-        $classLoader->register();
-        
+    {        
         $config = new \Doctrine\ORM\Configuration();
         $config = new \Doctrine\ORM\Configuration();
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);

+ 1 - 4
tests/Gedmo/Translatable/EntityTranslationTableTest.php

@@ -23,10 +23,7 @@ class EntityTranslationTableTest extends \PHPUnit_Framework_TestCase
     private $em;
     private $em;
 
 
     public function setUp()
     public function setUp()
-    {
-        $classLoader = new \Doctrine\Common\ClassLoader('Translatable\Fixture', __DIR__ . '/../');
-        $classLoader->register();
-        
+    {        
         $config = new \Doctrine\ORM\Configuration();
         $config = new \Doctrine\ORM\Configuration();
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);

+ 1 - 4
tests/Gedmo/Translatable/InheritanceTest.php

@@ -24,10 +24,7 @@ class InheritanceTest extends \PHPUnit_Framework_TestCase
     private $em;
     private $em;
 
 
     public function setUp()
     public function setUp()
-    {
-        $classLoader = new \Doctrine\Common\ClassLoader('Translatable\Fixture', __DIR__ . '/../');
-        $classLoader->register();
-        
+    {        
         $config = new \Doctrine\ORM\Configuration();
         $config = new \Doctrine\ORM\Configuration();
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);

+ 1 - 4
tests/Gedmo/Translatable/TranslatableIdentifierTest.php

@@ -22,10 +22,7 @@ class TranslatableIdentifierTest extends \PHPUnit_Framework_TestCase
     private $em;
     private $em;
 
 
     public function setUp()
     public function setUp()
-    {
-        $classLoader = new \Doctrine\Common\ClassLoader('Translatable\Fixture', __DIR__ . '/../');
-        $classLoader->register();
-        
+    {        
         $config = new \Doctrine\ORM\Configuration();
         $config = new \Doctrine\ORM\Configuration();
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);

+ 1 - 4
tests/Gedmo/Translatable/TranslatableTest.php

@@ -23,10 +23,7 @@ class TranslatableTest extends \PHPUnit_Framework_TestCase
     private $em;
     private $em;
 
 
     public function setUp()
     public function setUp()
-    {
-        $classLoader = new \Doctrine\Common\ClassLoader('Translatable\Fixture', __DIR__ . '/../');
-        $classLoader->register();
-        
+    {        
         $config = new \Doctrine\ORM\Configuration();
         $config = new \Doctrine\ORM\Configuration();
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);

+ 1 - 4
tests/Gedmo/Tree/ConcurrencyTest.php

@@ -23,10 +23,7 @@ class ConcurrencyTest extends \PHPUnit_Framework_TestCase
     private $em;
     private $em;
 
 
     public function setUp()
     public function setUp()
-    {
-        $classLoader = new \Doctrine\Common\ClassLoader('Tree\Fixture', __DIR__ . '/../');
-        $classLoader->register();
-        
+    {        
         $config = new \Doctrine\ORM\Configuration();
         $config = new \Doctrine\ORM\Configuration();
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);

+ 1 - 4
tests/Gedmo/Tree/MultiInheritanceTest.php

@@ -21,10 +21,7 @@ class MultiInheritanceTest extends \PHPUnit_Framework_TestCase
     private $em;
     private $em;
 
 
     public function setUp()
     public function setUp()
-    {
-        $classLoader = new \Doctrine\Common\ClassLoader('Tree\Fixture', __DIR__ . '/../');
-        $classLoader->register();
-        
+    {        
         $config = new \Doctrine\ORM\Configuration();
         $config = new \Doctrine\ORM\Configuration();
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);

+ 1 - 4
tests/Gedmo/Tree/RepositoryTest.php

@@ -20,10 +20,7 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase
     private $em;
     private $em;
 
 
     public function setUp()
     public function setUp()
-    {
-        $classLoader = new \Doctrine\Common\ClassLoader('Tree\Fixture', __DIR__ . '/../');
-        $classLoader->register();
-        
+    {        
         $config = new \Doctrine\ORM\Configuration();
         $config = new \Doctrine\ORM\Configuration();
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);

+ 1 - 4
tests/Gedmo/Tree/TranslatableSluggableTreeTest.php

@@ -29,10 +29,7 @@ class TranslatableSluggableTreeTest extends \PHPUnit_Framework_TestCase
     private $translationListener;
     private $translationListener;
 
 
     public function setUp()
     public function setUp()
-    {
-        $classLoader = new \Doctrine\Common\ClassLoader('Tree\Fixture', __DIR__ . '/../');
-        $classLoader->register();
-        
+    {        
         $config = new \Doctrine\ORM\Configuration();
         $config = new \Doctrine\ORM\Configuration();
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);

+ 1 - 4
tests/Gedmo/Tree/TreeTest.php

@@ -19,10 +19,7 @@ class TreeTest extends \PHPUnit_Framework_TestCase
     private $em;
     private $em;
 
 
     public function setUp()
     public function setUp()
-    {
-        $classLoader = new \Doctrine\Common\ClassLoader('Tree\Fixture', __DIR__ . '/../');
-        $classLoader->register();
-        
+    {        
         $config = new \Doctrine\ORM\Configuration();
         $config = new \Doctrine\ORM\Configuration();
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
         $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache);

+ 16 - 0
tests/bootstrap.php

@@ -43,4 +43,20 @@ $classLoader = new Doctrine\Common\ClassLoader('Symfony', 'Doctrine');
 $classLoader->register();
 $classLoader->register();
       
       
 $classLoader = new Doctrine\Common\ClassLoader('Gedmo', __DIR__ . '/../lib');
 $classLoader = new Doctrine\Common\ClassLoader('Gedmo', __DIR__ . '/../lib');
+$classLoader->register();
+
+// fixture autoloaders
+$classLoader = new Doctrine\Common\ClassLoader('Translatable\Fixture', __DIR__ . '/Gedmo');
+$classLoader->register();
+
+$classLoader = new Doctrine\Common\ClassLoader('Tree\Fixture', __DIR__ . '/Gedmo');
+$classLoader->register();
+
+$classLoader = new Doctrine\Common\ClassLoader('Timestampable\Fixture', __DIR__ . '/Gedmo');
+$classLoader->register();
+
+$classLoader = new Doctrine\Common\ClassLoader('Sluggable\Fixture', __DIR__ . '/Gedmo');
+$classLoader->register();
+
+$classLoader = new Doctrine\Common\ClassLoader('Mapping\Fixture', __DIR__ . '/Gedmo');
 $classLoader->register();
 $classLoader->register();