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()