/** * @test */ public function should_remove_translation() { $em = $this->getEntityManager(); $entity = new \BehaviorFixtures\ORM\TranslatableEntity(); $entity->translate('en')->setTitle('Hello'); $entity->translate('nl')->setTitle('Hallo'); $entity->mergeNewTranslations(); $em->persist($entity); $em->flush(); $nlTranslation = $entity->translate('nl'); $entity->removeTranslation($nlTranslation); $em->flush(); $em->refresh($entity); $this->assertNotEquals('Hallo', $entity->translate('nl')->getTitle()); }
/** * @test */ public function translate_method_should_always_return_translation_object() { $em = $this->getEntityManager(); $entity = new \BehaviorFixtures\ORM\TranslatableEntity(); $this->assertInstanceOf('BehaviorFixtures\\ORM\\TranslatableEntityTranslation', $entity->translate('fr')); }