snipe_it/tests/Feature/Locations/Ui/ShowLocationTest.php
snipe 04f8ebb4d8 Added tests
Signed-off-by: snipe <snipe@snipe.net>
2025-04-09 06:17:08 +01:00

40 lines
1.1 KiB
PHP

<?php
namespace Tests\Feature\Locations\Ui;
use App\Models\Location;
use App\Models\User;
use Tests\TestCase;
class ShowLocationTest extends TestCase
{
public function testPageRenders()
{
$this->actingAs(User::factory()->superuser()->create())
->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();
}
}