Просмотр исходного кода

[tests] improve translate method tests

gedi 13 лет назад
Родитель
Сommit
3689f9fa22
1 измененных файлов с 7 добавлено и 1 удалено
  1. 7 1
      tests/Gedmo/Translatable/TranslatableEntityCollectionTest.php

+ 7 - 1
tests/Gedmo/Translatable/TranslatableEntityCollectionTest.php

@@ -64,6 +64,12 @@ class TranslatableEntityCollectionTest extends BaseTestCaseORM
 
         $this->em->persist($entity);
         $this->em->flush();
+        $this->em->clear();
+        $trans = $repo->findTranslations($this->em->find(self::ARTICLE, $entity->getId()));
+        $this->assertEquals(3, count($trans)); // EN is default, and left in original record
+        $this->assertSame('my article de', $trans['de']['title']); // overrides "he" which would be used if translate for de not called
+        $this->assertSame('my article es', $trans['es']['title']);
+        $this->assertSame('my article fr', $trans['fr']['title']);
     }
 
     /**
@@ -184,4 +190,4 @@ class TranslatableEntityCollectionTest extends BaseTestCaseORM
             self::COMMENT
         );
     }
-}
+}