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