|
@@ 109-120 (lines=12) @@
|
| 106 |
|
|
| 107 |
|
// Deleting |
| 108 |
|
|
| 109 |
|
public function test_it_deletes_translations() |
| 110 |
|
{ |
| 111 |
|
$city = City::find(1); |
| 112 |
|
$cityId = $city->id; |
| 113 |
|
$translation = $city->translate('en'); |
| 114 |
|
$this->assertTrue(is_object($translation)); |
| 115 |
|
$city->delete(); |
| 116 |
|
$city = City::find($cityId); |
| 117 |
|
$this->assertNull($city); |
| 118 |
|
$translations = CityTranslation::where('city_id', '=', $cityId)->get(); |
| 119 |
|
$this->assertEquals(0, count($translations)); |
| 120 |
|
} |
| 121 |
|
|
| 122 |
|
public function test_it_does_not_delete_translations_when_attempting_to_delete_translatable() |
| 123 |
|
{ |
|
@@ 122-138 (lines=17) @@
|
| 119 |
|
$this->assertEquals(0, count($translations)); |
| 120 |
|
} |
| 121 |
|
|
| 122 |
|
public function test_it_does_not_delete_translations_when_attempting_to_delete_translatable() |
| 123 |
|
{ |
| 124 |
|
$country = Country::find(1); |
| 125 |
|
$countryId = $country->id; |
| 126 |
|
$translation = $country->translate('en'); |
| 127 |
|
$this->assertTrue(is_object($translation)); |
| 128 |
|
try { |
| 129 |
|
$country->delete(); |
| 130 |
|
} catch (\Exception $e) { |
| 131 |
|
} |
| 132 |
|
|
| 133 |
|
$country = Country::find(1); |
| 134 |
|
$this->assertNotNull($country); |
| 135 |
|
|
| 136 |
|
$translations = CountryTranslation::where('country_id', '=', $countryId)->get(); |
| 137 |
|
$this->assertEquals(4, count($translations)); |
| 138 |
|
} |
| 139 |
|
|
| 140 |
|
public function test_it_does_not_delete_translations_while_force_deleting() |
| 141 |
|
{ |