/**
  * @test
  */
 function shouldRespectFallbackOption()
 {
     $article = new Article();
     $article->setTitle('Euro2012');
     $article->setAuthor('Shevchenko');
     $article->setViews(10);
     $this->em->persist($article);
     $this->em->flush();
     $this->em->clear();
     $this->translatableListener->setTranslatableLocale('ua_UA');
     $this->translatableListener->setTranslationFallback(true);
     $article = $this->em->find(self::ARTICLE, $article->getId());
     $this->assertEquals('Euro2012', $article->getTitle());
     $this->assertEquals('Shevchenko', $article->getAuthor());
     $this->assertEmpty($article->getViews());
     $this->em->clear();
     $this->translatableListener->setTranslationFallback(false);
     $article = $this->em->find(self::ARTICLE, $article->getId());
     $this->assertEmpty($article->getTitle());
     $this->assertEquals('Shevchenko', $article->getAuthor());
     $this->assertEmpty($article->getViews());
 }
 private function populate()
 {
     $repo = $this->em->getRepository(self::ARTICLE);
     $commentRepo = $this->em->getRepository(self::COMMENT);
     $food = new Article();
     $food->setTitle('Food');
     $food->setContent('about food');
     $food->setAuthor('John Doe');
     $food->setViews(99);
     $goodFood = new Comment();
     $goodFood->setArticle($food);
     $goodFood->setMessage('food is good');
     $goodFood->setSubject('good');
     $badFood = new Comment();
     $badFood->setArticle($food);
     $badFood->setMessage('food is bad');
     $badFood->setSubject('bad');
     $this->em->persist($food);
     $this->em->persist($goodFood);
     $this->em->persist($badFood);
     $this->em->flush();
     $this->em->clear();
     $this->translatableListener->setTranslatableLocale('lt_lt');
     $food = $repo->find(1);
     $food->setTitle('Maistas');
     $food->setContent('apie maista');
     $food->setViews(999);
     $goodFood = $commentRepo->find(1);
     $goodFood->setArticle($food);
     $goodFood->setMessage('maistas yra geras');
     $goodFood->setSubject('geras');
     $badFood = $commentRepo->find(2);
     $badFood->setArticle($food);
     $badFood->setMessage('maistas yra blogas');
     $badFood->setSubject('blogas');
     $this->em->persist($food);
     $this->em->persist($goodFood);
     $this->em->persist($badFood);
     $this->em->flush();
     $this->em->clear();
 }