/**
  *  @test
  */
 public function to_array_features_translated_attributes()
 {
     $dummy = Dummy::create(['title' => 'Dummy title', 'text' => 'Dummy text']);
     $this->assertEquals(1, Dummy::count());
     // Change the text on the translation object:
     $titleTranslation = $this->translationRepository->findByLangCode('en', $dummy->translationCodeFor('title'));
     $titleTranslation->text = 'Translated text';
     $titleTranslation->save();
     // Verify that toArray pulls from the translation and not model's value, and that the _translation attributes are hidden
     $this->assertEquals(['title' => 'Translated text', 'text' => 'Dummy text'], $dummy->makeHidden(['created_at', 'updated_at', 'slug', 'id'])->toArray());
 }
 /**
  * @test
  */
 public function it_saves_translations()
 {
     $dummy = new Dummy();
     $dummy->title = 'Dummy title';
     $dummy->text = 'Dummy text';
     $saved = $dummy->save() ? true : false;
     $this->assertTrue($saved);
     $this->assertEquals(1, Dummy::count());
     $this->assertEquals('slug', $dummy->slug);
     // Check that there is a language entry in the database:
     $titleTranslation = $this->translationRepository->findByLangCode('en', $dummy->translationCodeFor('title'));
     $this->assertEquals('Dummy title', $titleTranslation->text);
     $this->assertEquals('Dummy title', $dummy->title);
     $textTranslation = $this->translationRepository->findByLangCode('en', $dummy->translationCodeFor('text'));
     $this->assertEquals('Dummy text', $textTranslation->text);
     $this->assertEquals('Dummy text', $dummy->text);
     // Delete it:
     $deleted = $dummy->delete();
     $this->assertTrue($deleted);
     $this->assertEquals(0, Dummy::count());
     $this->assertEquals(0, $this->translationRepository->count());
 }