Skip to content

Commit a4587f6

Browse files
authored
Merge pull request #16335 from snipe/added_label_test
Added label test
2 parents 8a40c3e + 163e19f commit a4587f6

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
namespace Tests\Feature\Assets\Ui;
4+
5+
use App\Models\Accessory;
6+
use App\Models\Actionlog;
7+
use App\Models\Asset;
8+
use App\Models\User;
9+
use Tests\TestCase;
10+
11+
class AssetLabelTest extends TestCase
12+
{
13+
public function testUserWithPermissionsCanAccessPage()
14+
{
15+
$assets = Asset::factory()->count(20)->create();
16+
$id_array = $assets->pluck('id')->toArray();
17+
18+
$this->actingAs(User::factory()->viewAssets()->create())->post('/hardware/bulkedit', [
19+
'ids' => $id_array,
20+
'bulk_actions' => 'labels',
21+
])->assertStatus(200);
22+
}
23+
24+
public function testRedirectOfNoAssetsSelected()
25+
{
26+
$id_array = [];
27+
$this->actingAs(User::factory()->viewAssets()->create())
28+
->from(route('hardware.index'))
29+
->post('/hardware/bulkedit', [
30+
'ids' => $id_array,
31+
'bulk_actions' => 'Labels',
32+
])->assertStatus(302)
33+
->assertRedirect(route('hardware.index'));
34+
}
35+
36+
}

0 commit comments

Comments
 (0)