Exemple #1
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());
 }
 /**
  * @test
  * @group bug#3
  * @group bug#7
  * @group develop
  */
 public function a_locales_array_can_be_passed_to_create_them()
 {
     $article = new Article(['otro' => 'aki', 'en' => ['title' => 'My title'], 'commentable' => true]);
     $article->save();
     $this->assertEquals("My title", $article->en()->title);
     $article = Article::create(['locales' => ['en' => ['title' => 'My title']], 'commentable' => true]);
     $this->assertEquals("My title", $article->en()->title);
 }