/**
  * @test
  * @expectedException \Mosaiqo\Translatable\Exceptions\AttributeNotTranslatable
  */
 public function it_can_only_set_attributes_specified_for_translation()
 {
     $article = new Article();
     $article->en()->name = "My name";
     $article->es()->title = "titulo";
     $article->ca()->title = "títol";
     $article->save();
     $this->assertEquals($article->es()->title, 'titulo');
     $this->assertEquals($article->ca()->title, 'títol');
 }
Example #2
0
 /**
  * @test
  */
 public function it_returns_all_the_translations()
 {
     $article = new Article();
     $article->en()->fill(['title' => 'My title']);
     $article->es()->fill(['title' => 'Mi titulo']);
     $article->save();
     $this->assertCount(2, $article->locales->getTranslations());
     $this->assertArrayHasKey('en', $article->locales->getTranslations());
     $this->assertArrayHasKey('es', $article->locales->getTranslations());
     $this->assertArrayNotHasKey('de', $article->locales->getTranslations());
 }