/**
  * Test translatable and uploadable properties
  */
 public function testTranslatableUplodableProperties()
 {
     $article = new Article();
     $article->setDate(new \DateTime());
     $article->setLocale($this->_languagePl);
     $article->setTitle(self::POLISH_TITLE_1);
     $article->setContents(self::POLISH_CONTENTS_1);
     $article->setIntroImage(new \SplFileInfo(TESTS_PATH . self::TEST_FILE1));
     $this->_em->persist($article);
     $this->_em->flush();
     $article->setLocale($this->_languageEn);
     $article->setTitle(self::ENGLISH_TITLE_1);
     $article->setContents(self::ENGLISH_CONTENTS_1);
     $article->setIntroImage(new \SplFileInfo(TESTS_PATH . self::TEST_FILE2));
     $this->_em->flush();
     $this->_em->clear();
     $this->_translatableListener->setLocale($this->_languagePl);
     $article = $this->_em->find(self::ARTICLE, $article->getId());
     $file1 = $article->getIntroImage()->getKey();
     $this->assertFileExists(FILESYSTEM1 . $file1);
     $this->_em->clear();
     $this->_translatableListener->setLocale($this->_languageEn);
     $article = $this->_em->find(self::ARTICLE, $article->getId());
     $file2 = $article->getIntroImage()->getKey();
     $this->assertFileExists(FILESYSTEM1 . $file2);
     $this->assertNotSame($file1, $file2);
 }
 /**
  * Test entity creation with two translation and check its state after $em->clear(), change default locale and load with some
  * specific translation
  */
 public function testInsertWithTwoTranslationsClearAndLoadTranslation()
 {
     $article = new Article();
     $article->setDate(new \DateTime());
     $article->setLocale($this->_languagePl);
     $article->setTitle(self::POLISH_TITLE_1);
     $article->setContents(self::POLISH_CONTENTS_1);
     $this->_em->persist($article);
     $this->_em->flush();
     $article->setLocale($this->_languageEn);
     $article->setTitle(self::ENGLISH_TITLE_1);
     $article->setContents(self::ENGLISH_CONTENTS_1);
     $this->_em->flush();
     $this->_em->clear();
     $this->_translatableListener->setLocale($this->_languagePl);
     $article = $this->_em->find(self::ARTICLE, $article->getId());
     $this->_logger->enabled = true;
     $this->_translatableListener->loadTranslation($this->_em, $article, $this->_languageEn);
     $this->assertEquals(0, count($this->_logger->queries), 'Reloading executed wrong number of queries');
     $this->assertEquals(2, count($article->getTranslations()), 'Number of translations is not valid');
     $this->assertAttributeEquals(self::ENGLISH_TITLE_1, 'title', $article);
     $this->assertAttributeEquals(self::ENGLISH_CONTENTS_1, 'contents', $article);
 }