A free open source IT asset/license management system
Basic tests
snipe9c4191ae0ac4
diff --git a/tests/Feature/Settings/LabelSettingTest.php b/tests/Feature/Settings/LabelSettingTest.phpnew file mode 100644index 0000000000..276e49866a--- /dev/null+++ b/tests/Feature/Settings/LabelSettingTest.php@@ -0,0 +1,22 @@+<?php++namespace Tests\Feature\Settings;++use App\Models\Asset;+use Tests\TestCase;+use Illuminate\Http\UploadedFile;+use Illuminate\Support\Facades\Storage;+use App\Models\User;+use App\Models\Setting;+++class LabelSettingTest extends TestCase+{+ public function testPermissionRequiredToViewLabelSettings()+ {+ $this->actingAs(User::factory()->create())+ ->get(route('settings.labels.index'))+ ->assertForbidden();+ }++}diff --git a/tests/Feature/Settings/LdapSettingsTests.php b/tests/Feature/Settings/LdapSettingsTests.phpnew file mode 100644index 0000000000..33adfc4b43--- /dev/null+++ b/tests/Feature/Settings/LdapSettingsTests.php@@ -0,0 +1,33 @@+<?php++namespace Tests\Feature\Settings;++use App\Models\Asset;+use Tests\TestCase;+use Illuminate\Http\UploadedFile;+use Illuminate\Support\Facades\Storage;+use App\Models\User;+use App\Models\Setting;+++class LdapSettingsTests extends TestCase+{+ public function testPermissionRequiredToViewLdapSettings()+ {+ $this->actingAs(User::factory()->create())+ ->get(route('settings.ldap.index'))+ ->assertForbidden();+ }++ public function testLdapSettingsCanBeSaved()+ {+ $response = $this->actingAs(User::factory()->superuser()->create())+ ->post(route('settings.alerts.save', ['ldap_enabled' => 1]))+ ->assertStatus(302)+ ->assertValid('alert_email')+ ->assertRedirect(route('settings.index'))+ ->assertSessionHasNoErrors();+ $this->followRedirects($response)->assertSee('alert-success');+ }++}diff --git a/tests/Feature/Settings/SecuritySettingTest.php b/tests/Feature/Settings/SecuritySettingTest.phpnew file mode 100644index 0000000000..d81df5599e--- /dev/null+++ b/tests/Feature/Settings/SecuritySettingTest.php@@ -0,0 +1,22 @@+<?php++namespace Tests\Feature\Settings;++use App\Models\Asset;+use Tests\TestCase;+use Illuminate\Http\UploadedFile;+use Illuminate\Support\Facades\Storage;+use App\Models\User;+use App\Models\Setting;+++class SecuritySettingTest extends TestCase+{+ public function testPermissionRequiredToViewSecuritySettings()+ {+ $this->actingAs(User::factory()->create())+ ->get(route('settings.security.index'))+ ->assertForbidden();+ }++}