From f5705a1dde7a736e167e27ec156f72351cfb47ec Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Mon, 16 Sep 2024 14:34:55 -0700 Subject: [PATCH] More unification --- tests/Feature/Departments/Api/DeleteDepartmentTest.php | 8 ++++---- .../Feature/Depreciations/Api/DeleteDepreciationTest.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/Feature/Departments/Api/DeleteDepartmentTest.php b/tests/Feature/Departments/Api/DeleteDepartmentTest.php index 5865a7f2e5aa..3dcdd703711b 100644 --- a/tests/Feature/Departments/Api/DeleteDepartmentTest.php +++ b/tests/Feature/Departments/Api/DeleteDepartmentTest.php @@ -48,9 +48,9 @@ public function testAdheresToMultipleFullCompanySupportScoping() ->deleteJson(route('api.departments.destroy', $departmentC)) ->assertStatusMessageIs('success'); - $this->assertNotNull($departmentA->fresh(), 'Department unexpectedly deleted'); - $this->assertNotNull($departmentB->fresh(), 'Department unexpectedly deleted'); - $this->assertNull($departmentC->fresh(), 'Department was not deleted'); + $this->assertDatabaseHas('departments', ['id' => $departmentA->id]); + $this->assertDatabaseHas('departments', ['id' => $departmentB->id]); + $this->assertDatabaseMissing('departments', ['id' => $departmentC->id]); } public function testCannotDeleteDepartmentThatStillHasUsers() @@ -61,7 +61,7 @@ public function testCannotDeleteDepartmentThatStillHasUsers() ->deleteJson(route('api.departments.destroy', $department)) ->assertStatusMessageIs('error'); - $this->assertNotNull($department->fresh(), 'Department unexpectedly deleted'); + $this->assertDatabaseHas('departments', ['id' => $department->id]); } public function testCanDeleteDepartment() diff --git a/tests/Feature/Depreciations/Api/DeleteDepreciationTest.php b/tests/Feature/Depreciations/Api/DeleteDepreciationTest.php index a8ec45f6ede0..277eba534b21 100644 --- a/tests/Feature/Depreciations/Api/DeleteDepreciationTest.php +++ b/tests/Feature/Depreciations/Api/DeleteDepreciationTest.php @@ -28,7 +28,7 @@ public function testCannotDeleteDepreciationThatHasAssociatedModels() ->deleteJson(route('api.depreciations.destroy', $depreciation)) ->assertStatusMessageIs('error'); - $this->assertNotNull($depreciation->fresh(), 'Depreciation unexpectedly deleted'); + $this->assertDatabaseHas('depreciations', ['id' => $depreciation->id]); } public function testCanDeleteDepreciation()