Skip to content

A free open source IT asset/license management system

Added label test

snipe163e19f1e90b
diff --git a/tests/Feature/Assets/Ui/AssetLabelTest.php b/tests/Feature/Assets/Ui/AssetLabelTest.php
new file mode 100644
index 0000000000..ddf57828bf
--- /dev/null
+++ b/tests/Feature/Assets/Ui/AssetLabelTest.php
@@ -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'));
+ }
+
+}