Unify assertion method

This commit is contained in:
Marcus Moore 2024-09-16 14:32:38 -07:00
parent 1fddacd7d0
commit f325c4afdb
No known key found for this signature in database
17 changed files with 34 additions and 0 deletions

View file

@ -18,6 +18,8 @@ class DeleteAccessoriesTest extends TestCase implements TestsMultipleFullCompany
$this->actingAsForApi(User::factory()->create())
->deleteJson(route('api.accessories.destroy', $accessory))
->assertForbidden();
$this->assertNotSoftDeleted($accessory);
}
public function testAdheresToMultipleFullCompanySupportScoping()

View file

@ -18,6 +18,8 @@ class DeleteAssetMaintenancesTest extends TestCase implements TestsMultipleFullC
$this->actingAsForApi(User::factory()->create())
->deleteJson(route('api.maintenances.destroy', $assetMaintenance))
->assertForbidden();
$this->assertNotSoftDeleted($assetMaintenance);
}
public function testAdheresToMultipleFullCompanySupportScoping()

View file

@ -17,6 +17,8 @@ class DeleteAssetModelsTest extends TestCase implements TestsPermissionsRequirem
$this->actingAsForApi(User::factory()->create())
->deleteJson(route('api.models.destroy', $assetModel))
->assertForbidden();
$this->assertNotSoftDeleted($assetModel);
}
public function testCannotDeleteAssetModelThatStillHasAssociatedAssets()

View file

@ -18,6 +18,8 @@ class DeleteAssetsTest extends TestCase implements TestsMultipleFullCompanySuppo
$this->actingAsForApi(User::factory()->create())
->deleteJson(route('api.assets.destroy', $asset))
->assertForbidden();
$this->assertNotSoftDeleted($asset);
}
public function testAdheresToMultipleFullCompanySupportScoping()

View file

@ -17,6 +17,8 @@ class DeleteCategoriesTest extends TestCase implements TestsPermissionsRequireme
$this->actingAsForApi(User::factory()->create())
->deleteJson(route('api.categories.destroy', $category))
->assertForbidden();
$this->assertNotSoftDeleted($category);
}
public function testCannotDeleteCategoryThatStillHasAssociatedItems()

View file

@ -16,6 +16,8 @@ class DeleteCompaniesTest extends TestCase implements TestsPermissionsRequiremen
$this->actingAsForApi(User::factory()->create())
->deleteJson(route('api.companies.destroy', $company))
->assertForbidden();
$this->assertDatabaseHas('companies', ['id' => $company->id]);
}
public function testCannotDeleteCompanyThatHasAssociatedItems()

View file

@ -18,6 +18,8 @@ class DeleteComponentsTest extends TestCase implements TestsMultipleFullCompanyS
$this->actingAsForApi(User::factory()->create())
->deleteJson(route('api.components.destroy', $component))
->assertForbidden();
$this->assertNotSoftDeleted($component);
}
public function testAdheresToMultipleFullCompanySupportScoping()

View file

@ -18,6 +18,8 @@ class DeleteConsumablesTest extends TestCase implements TestsMultipleFullCompany
$this->actingAsForApi(User::factory()->create())
->deleteJson(route('api.consumables.destroy', $consumable))
->assertForbidden();
$this->assertNotSoftDeleted($consumable);
}
public function testAdheresToMultipleFullCompanySupportScoping()

View file

@ -19,6 +19,8 @@ class DeleteCustomFieldsTest extends TestCase implements TestsPermissionsRequire
$this->actingAsForApi(User::factory()->create())
->deleteJson(route('api.customfields.destroy', $customField))
->assertForbidden();
$this->assertDatabaseHas('custom_fields', ['id' => $customField->id]);
}
public function testCustomFieldsCannotBeDeletedIfTheyHaveAssociatedFieldsets()

View file

@ -19,6 +19,8 @@ class DeleteCustomFieldsetsTest extends TestCase implements TestsPermissionsRequ
$this->actingAsForApi(User::factory()->create())
->deleteJson(route('api.fieldsets.destroy', $customFieldset))
->assertForbidden();
$this->assertDatabaseHas('custom_fieldsets', ['id' => $customFieldset->id]);
}
public function testCannotDeleteCustomFieldsetWithAssociatedFields()

View file

@ -18,6 +18,8 @@ class DeleteDepartmentTest extends TestCase implements TestsMultipleFullCompanyS
$this->actingAsForApi(User::factory()->create())
->deleteJson(route('api.departments.destroy', $department))
->assertForbidden();
$this->assertDatabaseHas('departments', ['id' => $department->id]);
}
public function testAdheresToMultipleFullCompanySupportScoping()

View file

@ -16,6 +16,8 @@ class DeleteDepreciationTest extends TestCase implements TestsPermissionsRequire
$this->actingAsForApi(User::factory()->create())
->deleteJson(route('api.depreciations.destroy', $depreciation))
->assertForbidden();
$this->assertDatabaseHas('depreciations', ['id' => $depreciation->id]);
}
public function testCannotDeleteDepreciationThatHasAssociatedModels()

View file

@ -16,6 +16,8 @@ class DeleteGroupTest extends TestCase implements TestsPermissionsRequirement
$this->actingAsForApi(User::factory()->create())
->deleteJson(route('api.groups.destroy', $group))
->assertForbidden();
$this->assertDatabaseHas('permission_groups', ['id' => $group->id]);
}
public function testCanDeleteGroup()

View file

@ -18,6 +18,8 @@ class DeleteLicenseTest extends TestCase implements TestsMultipleFullCompanySupp
$this->actingAsForApi(User::factory()->create())
->deleteJson(route('api.licenses.destroy', $license))
->assertForbidden();
$this->assertNotSoftDeleted($license);
}
public function testAdheresToMultipleFullCompanySupportScoping()

View file

@ -17,6 +17,8 @@ class DeletePredefinedKitTest extends TestCase implements TestsPermissionsRequir
$this->actingAsForApi(User::factory()->create())
->deleteJson(route('api.kits.destroy', $predefinedKit))
->assertForbidden();
$this->assertDatabaseHas('kits', ['id' => $predefinedKit->id]);
}
public function testCanDeletePredefinedKits()

View file

@ -16,6 +16,8 @@ class DeleteStatusLabelTest extends TestCase implements TestsPermissionsRequirem
$this->actingAsForApi(User::factory()->create())
->deleteJson(route('api.statuslabels.destroy', $statusLabel))
->assertForbidden();
$this->assertNotSoftDeleted($statusLabel);
}
public function testCannotDeleteStatusLabelWhileStillAssociatedToAssets()

View file

@ -17,6 +17,8 @@ class DeleteSupplierTest extends TestCase implements TestsPermissionsRequirement
$this->actingAsForApi(User::factory()->create())
->deleteJson(route('api.suppliers.destroy', $supplier))
->assertForbidden();
$this->assertNotSoftDeleted($supplier);
}
public function testCannotDeleteSupplierWithDataStillAssociated()