mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Add validation test
This commit is contained in:
parent
4ed3347f52
commit
5ecdb7e07c
|
@ -3,6 +3,7 @@
|
||||||
namespace Tests\Feature\Users\Ui;
|
namespace Tests\Feature\Users\Ui;
|
||||||
|
|
||||||
use App\Models\Accessory;
|
use App\Models\Accessory;
|
||||||
|
use App\Models\Asset;
|
||||||
use App\Models\Consumable;
|
use App\Models\Consumable;
|
||||||
use App\Models\Statuslabel;
|
use App\Models\Statuslabel;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
@ -23,6 +24,31 @@ class BulkDeleteUsersTest extends TestCase
|
||||||
->assertForbidden();
|
->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()
|
public function testAccessoryCheckinsAreProperlyLogged()
|
||||||
{
|
{
|
||||||
[$accessoryA, $accessoryB] = Accessory::factory()->count(2)->create();
|
[$accessoryA, $accessoryB] = Accessory::factory()->count(2)->create();
|
||||||
|
|
Loading…
Reference in a new issue