File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments