Exemplo n.º 1
0
 public function testRemoveTranslation()
 {
     $translation = $this->createTranslationMock();
     $translation->expects($this->any())->method('getLocale')->will($this->returnValue($locale = 'fr_FR'));
     $translation->expects($this->exactly(2))->method('setTranslatable')->withConsecutive([$this->identicalTo($this->translatable)], [$this->isNull()]);
     $this->translatable->addTranslation($translation);
     $this->translatable->removeTranslation($translation);
     $this->assertTrue($this->translatable->getTranslations()->isEmpty());
 }
Exemplo n.º 2
0
 public function testTranslationCreated()
 {
     $this->translatable->setLocales([$locale = 'fr_FR']);
     $this->translatable->setFallbackLocale('en_EN');
     $this->translatable->setTranslationClass($translationClass = ConcreteTranslatableTranslation::class);
     $translation = $this->translatable->getTranslation(true);
     $this->assertInstanceOf($translationClass, $translation);
     $this->assertSame($locale, $translation->getLocale());
     $this->assertSame([$locale => $translation], $this->translatable->getTranslations()->toArray());
 }