File tree 2 files changed +16
-1
lines changed
tests/Feature/Locations/Api
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -311,6 +311,11 @@ public function deleteCategories()
311
311
return $ this ->appendPermission (['categories.delete ' => '1 ' ]);
312
312
}
313
313
314
+ public function deleteLocations ()
315
+ {
316
+ return $ this ->appendPermission (['locations.delete ' => '1 ' ]);
317
+ }
318
+
314
319
public function canEditOwnLocation ()
315
320
{
316
321
return $ this ->appendPermission (['self.edit_location ' => '1 ' ]);
Original file line number Diff line number Diff line change 9
9
10
10
class DeleteLocationsTest extends TestCase
11
11
{
12
-
13
12
public function testErrorReturnedViaApiIfLocationDoesNotExist ()
14
13
{
15
14
$ this ->actingAsForApi (User::factory ()->superuser ()->create ())
@@ -90,4 +89,15 @@ public function testDisallowUserDeletionViaApiIfStillHasAssetsAsLocation()
90
89
->json ();
91
90
}
92
91
92
+ public function testCanDeleteLocation ()
93
+ {
94
+ $ location = Location::factory ()->create ();
95
+
96
+ $ this ->actingAsForApi (User::factory ()->deleteLocations ()->create ())
97
+ ->deleteJson (route ('api.locations.destroy ' , $ location ->id ))
98
+ ->assertOk ()
99
+ ->assertStatusMessageIs ('success ' );
100
+
101
+ $ this ->assertSoftDeleted ($ location );
102
+ }
93
103
}
You can’t perform that action at this time.
0 commit comments