/**
  * @test
  * @expectedException \Exception
  */
 public function it_throws_query_exception_if_saving_and_name_is_null()
 {
     $country = new Country();
     $country->iso = 'be';
     $country->name = null;
     $country->save();
 }
 private function createCountries($countries)
 {
     foreach ($countries as $data) {
         $country = new Country();
         $country->id = $data['id'];
         $country->code = $data['code'];
         $country->save();
     }
 }
 /**
  * @test
  */
 public function to_array_wont_break_if_no_translations_exist()
 {
     $country = new Country(['code' => 'test']);
     $country->save();
     $country->toArray();
 }
 /**
  * @test
  */
 public function it_creates_translations_using_the_shortcut()
 {
     $country = new Country();
     $country->iso = 'be';
     $country->name = 'Belgium';
     $country->save();
     $country = Country::whereIso('be')->first();
     $this->assertEquals('Belgium', $country->name);
 }
 public function test_getting_translated_field_does_not_create_translation()
 {
     $this->app->setLocale('en');
     $country = new Country(['code' => 'pl']);
     $country->save();
     $country->name;
     $this->assertSame($country->getTranslation('en'), null);
 }