/** * @test */ public function it_skips_mass_assignment_if_attributes_non_fillable() { $data = array('iso' => 'be', 'en' => ['name' => 'Belgium'], 'fr' => ['name' => 'Belgique']); $country = CountryStrict::create($data); $this->assertEquals('be', $country->iso); $this->assertNull($country->translate('en')->name); $this->assertNull($country->translate('fr')->name); }
/** * @test */ public function it_does_not_delete_translations_while_force_deleting() { $country = CountryStrict::find(2); $country->forceDelete(); $after = CountryTranslation::where('country_id', '=', 2)->get(); $this->assertEquals(0, count($after)); }
public function test_configuration_overrides_fillable() { App::make('config')->set('translatable.always_fillable', true); $country = new CountryStrict(['en' => ['name' => 'Not fillable'], 'code' => 'te']); $this->assertSame($country->getTranslation('en')->name, 'Not fillable'); }