Files
snipe-it/tests/Feature/Redirects/ModelNotFoundRedirectTest.php
snipe a6c6c7eae9 Updated tests
Signed-off-by: snipe <snipe@snipe.net>
2025-08-10 13:11:50 +01:00

52 lines
1.5 KiB
PHP

<?php
namespace Tests\Feature\Redirects;
use App\Models\User;
use Tests\TestCase;
class ModelNotFoundRedirectTest extends TestCase
{
public function testHandlesAsset404()
{
$this->actingAs(User::factory()->viewAssets()->create())
->get(route('hardware.checkout.create', 9999))
->assertRedirectToRoute('hardware.index');
}
public function testHandlesMaintenance404()
{
$this->actingAs(User::factory()->viewAssets()->create())
->get(route('maintenances.show', 9999))
->assertRedirectToRoute('maintenances.index');
}
public function testHandlesAssetModel404()
{
$this->actingAs(User::factory()->viewAssetModels()->create())
->get(route('models.show', 9999))
->assertRedirectToRoute('models.index');
}
public function testHandlesLicenseSeat404()
{
$this->actingAs(User::factory()->viewLicenses()->create())
->get(route('licenses.checkin', 9999))
->assertRedirectToRoute('licenses.index');
}
public function testHandlesPredefinedKit404()
{
$this->actingAs(User::factory()->viewPredefinedKits()->create())
->get(route('kits.show', 9999))
->assertRedirectToRoute('kits.index');
}
public function testHandlesReportTemplate404()
{
$this->actingAs(User::factory()->canViewReports()->create())
->get(route('report-templates.show', 9999))
->assertRedirectToRoute('reports/custom');
}
}