Added label test
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
8a40c3ecb4
commit
163e19f1e9
1 changed files with 36 additions and 0 deletions
36
tests/Feature/Assets/Ui/AssetLabelTest.php
Normal file
36
tests/Feature/Assets/Ui/AssetLabelTest.php
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature\Assets\Ui;
|
||||||
|
|
||||||
|
use App\Models\Accessory;
|
||||||
|
use App\Models\Actionlog;
|
||||||
|
use App\Models\Asset;
|
||||||
|
use App\Models\User;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class AssetLabelTest extends TestCase
|
||||||
|
{
|
||||||
|
public function testUserWithPermissionsCanAccessPage()
|
||||||
|
{
|
||||||
|
$assets = Asset::factory()->count(20)->create();
|
||||||
|
$id_array = $assets->pluck('id')->toArray();
|
||||||
|
|
||||||
|
$this->actingAs(User::factory()->viewAssets()->create())->post('/hardware/bulkedit', [
|
||||||
|
'ids' => $id_array,
|
||||||
|
'bulk_actions' => 'labels',
|
||||||
|
])->assertStatus(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRedirectOfNoAssetsSelected()
|
||||||
|
{
|
||||||
|
$id_array = [];
|
||||||
|
$this->actingAs(User::factory()->viewAssets()->create())
|
||||||
|
->from(route('hardware.index'))
|
||||||
|
->post('/hardware/bulkedit', [
|
||||||
|
'ids' => $id_array,
|
||||||
|
'bulk_actions' => 'Labels',
|
||||||
|
])->assertStatus(302)
|
||||||
|
->assertRedirect(route('hardware.index'));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue