Sfoglia il codice sorgente

[tests] updating translatable document tests, closes #165

gediminasm 13 anni fa
parent
commit
b7e0c0aa8a
1 ha cambiato i file con 29 aggiunte e 0 eliminazioni
  1. 29 0
      tests/Gedmo/Translatable/Issue/Issue165Test.php

+ 29 - 0
tests/Gedmo/Translatable/Issue/Issue165Test.php

@@ -69,7 +69,36 @@ class Issue165Test extends BaseTestCaseMongoODM
 
 
         $this->dm->persist($newarticle);
         $this->dm->persist($newarticle);
         $this->dm->flush();
         $this->dm->flush();
+        $this->dm->refresh($article);
 
 
         $this->assertEquals('de', $newarticle->getUntranslated());
         $this->assertEquals('de', $newarticle->getUntranslated());
+
+        $this->translationListener->setTranslatableLocale('en');
+
+        $id = $newarticle->getId();
+        $newarticle = $this->dm->getRepository('Translatable\Fixture\Issue165\SimpleArticle')->find($id);
+
+        $newarticle->setTitle('en');
+        $newarticle->setContent('en');
+        $newarticle->setUntranslated('en');
+
+        $this->dm->persist($newarticle);
+        $this->dm->flush();
+        $this->dm->refresh($newarticle);
+
+        $this->assertEquals('en', $newarticle->getUntranslated());
+
+        $this->translationListener->setTranslatableLocale('de');
+        $newarticle->setTitle('de2');
+        $newarticle->setContent('de2');
+        $newarticle->setUntranslated('de2');
+
+        $this->dm->persist($newarticle);
+        $this->dm->flush();
+
+        $id = $newarticle->getId();
+        $newarticle = $this->dm->getRepository('Translatable\Fixture\Issue165\SimpleArticle')->find($id);
+
+        $this->assertEquals('de2', $newarticle->getUntranslated());
     }
     }
 }
 }