mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-02 08:21:09 -08:00
30 lines
817 B
PHP
30 lines
817 B
PHP
<?php
|
|
|
|
namespace Tests\Feature\ReportTemplates;
|
|
|
|
use App\Models\ReportTemplate;
|
|
use App\Models\User;
|
|
use Tests\TestCase;
|
|
|
|
class DeleteReportTemplateTest extends TestCase
|
|
{
|
|
public function testDeletingReportTemplateRequiresCorrectPermission()
|
|
{
|
|
$this->actingAs(User::factory()->create())
|
|
->post(route('report-templates.destroy', 1))
|
|
->assertForbidden();
|
|
}
|
|
|
|
public function testCanDeleteAReportTemplate()
|
|
{
|
|
$user = User::factory()->canViewReports()->create();
|
|
$reportTemplate = ReportTemplate::factory()->for($user)->create();
|
|
|
|
$this->actingAs($user)
|
|
->delete(route('report-templates.destroy', $reportTemplate))
|
|
->assertRedirect(route('reports/custom'));
|
|
|
|
$this->assertFalse($reportTemplate->exists());
|
|
}
|
|
}
|