mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
Added another test
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
c570759370
commit
0f43b3f8f9
|
@ -33,4 +33,22 @@ class CreateAssetModelsTest extends TestCase
|
|||
$this->assertTrue(AssetModel::where('name', 'Test Model')->exists());
|
||||
}
|
||||
|
||||
public function testUserCannotUseAccessoryCategoryTypeAsAssetModelCategoryType()
|
||||
{
|
||||
|
||||
$response = $this->actingAs(User::factory()->superuser()->create())
|
||||
->from(route('models.create'))
|
||||
->post(route('models.store'), [
|
||||
'name' => 'Test Invalid Model Category',
|
||||
'category_id' => Category::factory()->forAccessories()->create()->id
|
||||
]);
|
||||
$response->assertStatus(302);
|
||||
$response->assertRedirect(route('models.create'));
|
||||
$response->assertInvalid(['category_type']);
|
||||
$response->assertSessionHasErrors(['category_type']);
|
||||
$this->followRedirects($response)->assertSee(trans('general.error'));
|
||||
$this->assertFalse(AssetModel::where('name', 'Test Invalid Model Category')->exists());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue