From 04f8ebb4d8f2bd9acf467c1f4bc41547109cd962 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 9 Apr 2025 06:17:08 +0100 Subject: [PATCH] Added tests Signed-off-by: snipe --- .../Feature/Locations/Ui/ShowLocationTest.php | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/Feature/Locations/Ui/ShowLocationTest.php b/tests/Feature/Locations/Ui/ShowLocationTest.php index 394ed73f4c..023ba06dff 100644 --- a/tests/Feature/Locations/Ui/ShowLocationTest.php +++ b/tests/Feature/Locations/Ui/ShowLocationTest.php @@ -14,4 +14,27 @@ class ShowLocationTest extends TestCase ->get(route('locations.show', Location::factory()->create())) ->assertOk(); } + + public function testDeniesAccessToRegularUser() + { + $this->actingAs(User::factory()->create()) + ->get(route('locations.show', Location::factory()->create())) + ->assertStatus(403) + ->assertForbidden(); + } + + public function testDeniesPrintAccessToRegularUser() + { + $this->actingAs(User::factory()->create()) + ->get(route('locations.print_all_assigned', Location::factory()->create())) + ->assertStatus(403) + ->assertForbidden(); + } + + public function testPageRendersForSuperAdmin() + { + $this->actingAs(User::factory()->superuser()->create()) + ->get(route('locations.print_all_assigned', Location::factory()->create())) + ->assertOk(); + } }