Skip to content

A free open source IT asset/license management system

Added more basic tests

snipe8c6ecd35ec4e
diff --git a/tests/Feature/Components/Ui/ComponentIndexTest.php b/tests/Feature/Components/Ui/ComponentIndexTest.php
new file mode 100644
index 0000000000..41b733e046
--- /dev/null
+++ b/tests/Feature/Components/Ui/ComponentIndexTest.php
@@ -0,0 +1,23 @@
+<?php
+
+namespace Tests\Feature\Components\Ui;
+
+use App\Models\User;
+use Tests\TestCase;
+
+class ComponentIndexTest extends TestCase
+{
+ public function testPermissionRequiredToViewComponentsList()
+ {
+ $this->actingAs(User::factory()->create())
+ ->get(route('components.index'))
+ ->assertForbidden();
+ }
+
+ public function testUserCanListComponents()
+ {
+ $this->actingAs(User::factory()->superuser()->create())
+ ->get(route('components.index'))
+ ->assertOk();
+ }
+}
diff --git a/tests/Feature/Consumables/Ui/ConsumableIndexTest.php b/tests/Feature/Consumables/Ui/ConsumableIndexTest.php
new file mode 100644
index 0000000000..3c438187ca
--- /dev/null
+++ b/tests/Feature/Consumables/Ui/ConsumableIndexTest.php
@@ -0,0 +1,23 @@
+<?php
+
+namespace Tests\Feature\Consumables\Ui;
+
+use App\Models\User;
+use Tests\TestCase;
+
+class ConsumableIndexTest extends TestCase
+{
+ public function testPermissionRequiredToViewConsumablesList()
+ {
+ $this->actingAs(User::factory()->create())
+ ->get(route('consumables.index'))
+ ->assertForbidden();
+ }
+
+ public function testUserCanListConsumables()
+ {
+ $this->actingAs(User::factory()->superuser()->create())
+ ->get(route('consumables.index'))
+ ->assertOk();
+ }
+}
diff --git a/tests/Feature/Groups/Ui/IndexGroupTest.php b/tests/Feature/Groups/Ui/IndexGroupTest.php
new file mode 100644
index 0000000000..a2d67f903c
--- /dev/null
+++ b/tests/Feature/Groups/Ui/IndexGroupTest.php
@@ -0,0 +1,25 @@
+<?php
+
+namespace Tests\Feature\Groups\Ui;
+
+use App\Models\User;
+use Tests\TestCase;
+
+class IndexGroupTest extends TestCase
+{
+ public function testPermissionRequiredToViewGroupList()
+ {
+ $this->actingAs(User::factory()->create())
+ ->get(route('groups.index'))
+ ->assertForbidden();
+
+ //$this->followRedirects($response)->assertSee('sad-panda.png');
+ }
+
+ public function testUserCanListGroups()
+ {
+ $this->actingAs(User::factory()->superuser()->create())
+ ->get(route('groups.index'))
+ ->assertOk();
+ }
+}
diff --git a/tests/Feature/Licenses/Ui/LicenseIndexTest.php b/tests/Feature/Licenses/Ui/LicenseIndexTest.php
new file mode 100644
index 0000000000..3eb33e5ee4
--- /dev/null
+++ b/tests/Feature/Licenses/Ui/LicenseIndexTest.php
@@ -0,0 +1,23 @@
+<?php
+
+namespace Tests\Feature\Licenses\Ui;
+
+use App\Models\User;
+use Tests\TestCase;
+
+class LicenseIndexTest extends TestCase
+{
+ public function testPermissionRequiredToViewLicenseList()
+ {
+ $this->actingAs(User::factory()->create())
+ ->get(route('licenses.index'))
+ ->assertForbidden();
+ }
+
+ public function testUserCanListLicenses()
+ {
+ $this->actingAs(User::factory()->superuser()->create())
+ ->get(route('licenses.index'))
+ ->assertOk();
+ }
+}