mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Add assertion
This commit is contained in:
parent
38b9f4a438
commit
2f76c1bc5b
|
@ -32,6 +32,17 @@ class DeleteDepartmentTest extends TestCase implements TestsMultipleFullCompanyS
|
|||
$this->assertDatabaseMissing('departments', ['id' => $department->id]);
|
||||
}
|
||||
|
||||
public function testCannotDeleteDepartmentThatStillHasUsers()
|
||||
{
|
||||
$department = Department::factory()->hasUsers()->create();
|
||||
|
||||
$this->actingAsForApi(User::factory()->deleteDepartments()->create())
|
||||
->deleteJson(route('api.departments.destroy', $department))
|
||||
->assertStatusMessageIs('error');
|
||||
|
||||
$this->assertNotNull($department->fresh(), 'Department unexpectedly deleted');
|
||||
}
|
||||
|
||||
public function testAdheresToMultipleFullCompanySupportScoping()
|
||||
{
|
||||
[$companyA, $companyB] = Company::factory()->count(2)->create();
|
||||
|
|
Loading…
Reference in a new issue