mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Add validation test
This commit is contained in:
parent
4ed3347f52
commit
5ecdb7e07c
|
@ -3,6 +3,7 @@
|
|||
namespace Tests\Feature\Users\Ui;
|
||||
|
||||
use App\Models\Accessory;
|
||||
use App\Models\Asset;
|
||||
use App\Models\Consumable;
|
||||
use App\Models\Statuslabel;
|
||||
use App\Models\User;
|
||||
|
@ -23,6 +24,31 @@ class BulkDeleteUsersTest extends TestCase
|
|||
->assertForbidden();
|
||||
}
|
||||
|
||||
public function testValidation()
|
||||
{
|
||||
// $this->markTestIncomplete();
|
||||
$user = User::factory()->create();
|
||||
Asset::factory()->assignedToUser($user)->create();
|
||||
|
||||
$actor = $this->actingAs(User::factory()->editUsers()->create());
|
||||
|
||||
// "ids" required
|
||||
$actor->post(route('users/bulksave'), [
|
||||
// 'ids' => [
|
||||
// $user->id,
|
||||
// ],
|
||||
'status_id' => Statuslabel::factory()->create()->id,
|
||||
])->assertSessionHas('error')->assertRedirect();
|
||||
|
||||
// "status_id" needed when provided users have assets associated
|
||||
$actor->post(route('users/bulksave'), [
|
||||
'ids' => [
|
||||
$user->id,
|
||||
],
|
||||
// 'status_id' => Statuslabel::factory()->create()->id,
|
||||
])->assertSessionHas('error')->assertRedirect();
|
||||
}
|
||||
|
||||
public function testAccessoryCheckinsAreProperlyLogged()
|
||||
{
|
||||
[$accessoryA, $accessoryB] = Accessory::factory()->count(2)->create();
|
||||
|
|
Loading…
Reference in a new issue