public function test_it_creates_a_new_translation()
 {
     App::make('config')->set('translatable.fallback_locale', 'en');
     $country = Country::create(['code' => 'gr']);
     $country->getNewTranslation('en')->name = 'Greece';
     $country->save();
     $this->assertEquals($country->translate('en')->name, 'Greece');
 }
Ejemplo n.º 2
0
 public function test_whereTranslationLike_filters_by_translation_and_locale()
 {
     Country::create(['code' => 'some-code', 'name' => 'Griechenland']);
     $this->assertSame(2, Country::whereTranslationLike('name', 'Griechen%')->count());
     $result = Country::whereTranslationLike('name', '%riechenlan%', 'de')->get();
     $this->assertSame(1, $result->count());
     $this->assertSame('gr', $result->first()->code);
 }