A free open source IT asset/license management system
Improve assertions
Marcus Moore0e35fb941b79
diff --git a/tests/Feature/ReportTemplates/DeleteReportTemplateTest.php b/tests/Feature/ReportTemplates/DeleteReportTemplateTest.phpindex 9a40ad83fc..cd29db1896 100644--- a/tests/Feature/ReportTemplates/DeleteReportTemplateTest.php+++ b/tests/Feature/ReportTemplates/DeleteReportTemplateTest.php@@ -17,7 +17,7 @@ class DeleteReportTemplateTest extends TestCase implements TestsPermissionsRequi$this->actingAs(User::factory()->create())->post(route('report-templates.destroy', $reportTemplate->id))- ->assertStatus(302);+ ->assertRedirect(route('reports/custom'));$this->assertNotSoftDeleted($reportTemplate);}@@ -28,7 +28,7 @@ class DeleteReportTemplateTest extends TestCase implements TestsPermissionsRequi$this->actingAs(User::factory()->canViewReports()->create())->delete(route('report-templates.destroy', $reportTemplate->id))- ->assertStatus(302)+ ->assertRedirect(route('reports/custom'))->assertSessionHas('error', trans('general.generic_model_not_found', ['model' => 'report template']));$this->assertNotSoftDeleted($reportTemplate);@@ -40,7 +40,7 @@ class DeleteReportTemplateTest extends TestCase implements TestsPermissionsRequi$this->actingAs(User::factory()->canViewReports()->create())->delete(route('report-templates.destroy', $reportTemplate->id))- ->assertStatus(302)+ ->assertRedirect(route('report-templates.show', $reportTemplate->id))->assertSessionHas('error', trans('general.generic_model_not_found', ['model' => 'report template']));$this->assertNotSoftDeleted($reportTemplate);diff --git a/tests/Feature/ReportTemplates/EditReportTemplateTest.php b/tests/Feature/ReportTemplates/EditReportTemplateTest.phpindex 576d0e5ffa..3f196747d9 100644--- a/tests/Feature/ReportTemplates/EditReportTemplateTest.php+++ b/tests/Feature/ReportTemplates/EditReportTemplateTest.php@@ -15,7 +15,7 @@ class EditReportTemplateTest extends TestCase implements TestsPermissionsRequire{$this->actingAs(User::factory()->create())->get(route('report-templates.edit', ReportTemplate::factory()->create()))- ->assertStatus(302);+ ->assertRedirectToRoute('reports/custom');}public function testCannotLoadEditPageForAnotherUsersReportTemplate()@@ -25,7 +25,7 @@ class EditReportTemplateTest extends TestCase implements TestsPermissionsRequire$this->actingAs($user)->get(route('report-templates.edit', $reportTemplate))- ->assertStatus(302);+ ->assertRedirectToRoute('reports/custom');}public function testCannotLoadEditPageForAnotherUsersSharedReportTemplate()@@ -35,7 +35,7 @@ class EditReportTemplateTest extends TestCase implements TestsPermissionsRequire$this->actingAs($user)->get(route('report-templates.edit', $reportTemplate))- ->assertStatus(302);+ ->assertRedirectToRoute('report-templates.show', $reportTemplate->id);}public function testCanLoadEditReportTemplatePage()diff --git a/tests/Feature/ReportTemplates/ShowReportTemplateTest.php b/tests/Feature/ReportTemplates/ShowReportTemplateTest.phpindex 7c33577acc..57cd737041 100644--- a/tests/Feature/ReportTemplates/ShowReportTemplateTest.php+++ b/tests/Feature/ReportTemplates/ShowReportTemplateTest.php@@ -15,7 +15,7 @@ class ShowReportTemplateTest extends TestCase implements TestsPermissionsRequire{$this->actingAs(User::factory()->create())->get(route('report-templates.show', ReportTemplate::factory()->create()))- ->assertStatus(302);+ ->assertRedirectToRoute('reports/custom');}public function testCanLoadASavedReportTemplate()@@ -38,7 +38,8 @@ class ShowReportTemplateTest extends TestCase implements TestsPermissionsRequire$this->actingAs(User::factory()->canViewReports()->create())->get(route('report-templates.show', $reportTemplate))- ->assertStatus(302);+ ->assertRedirectToRoute('reports/custom')+ ->assertSessionHas('error', trans('general.generic_model_not_found', ['model' => 'report template']));;}public function testCanLoadAnotherUsersSavedReportTemplateIfShared()diff --git a/tests/Feature/ReportTemplates/UpdateReportTemplateTest.php b/tests/Feature/ReportTemplates/UpdateReportTemplateTest.phpindex aab7e27e5b..5d77292999 100644--- a/tests/Feature/ReportTemplates/UpdateReportTemplateTest.php+++ b/tests/Feature/ReportTemplates/UpdateReportTemplateTest.php@@ -55,7 +55,7 @@ class UpdateReportTemplateTest extends TestCase implements TestsPermissionsRequi$this->actingAs($user)->post(route('report-templates.update', $reportTemplate), [- //+ 'category' => 1,])->assertSessionHasErrors(['name' => 'The name field is required.',