mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Unify assertion method
This commit is contained in:
parent
1fddacd7d0
commit
f325c4afdb
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue