Skip to content

A free open source IT asset/license management system

Added a setting test and validation on settings

snipe3167ee91d17e
diff --git a/app/Models/Setting.php b/app/Models/Setting.php
index 1a25735e0d..d775be81c5 100755
--- a/app/Models/Setting.php
+++ b/app/Models/Setting.php
@@ -74,7 +74,10 @@ class Setting extends Model
'login_remote_user_header_name' => 'string|nullable',
'thumbnail_max_h' => 'numeric|max:500|min:25',
'pwd_secure_min' => 'numeric|required|min:8',
+ 'alert_threshold' => 'numeric|nullable',
+ 'alert_interval' => 'numeric|nullable',
'audit_warning_days' => 'numeric|nullable',
+ 'due_checkin_days' => 'numeric|nullable',
'audit_interval' => 'numeric|nullable',
'custom_forgot_pass_url' => 'url|nullable',
'privacy_policy_link' => 'nullable|url',
diff --git a/tests/Feature/Settings/AlertsSettingTest.php b/tests/Feature/Settings/AlertsSettingTest.php
new file mode 100644
index 0000000000..87e7c0286a
--- /dev/null
+++ b/tests/Feature/Settings/AlertsSettingTest.php
@@ -0,0 +1,23 @@
+<?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 AlertsSettingTest extends TestCase
+{
+ public function testPermissionRequiredToViewAlertSettings()
+ {
+ $asset = Asset::factory()->create();
+ $this->actingAs(User::factory()->create())
+ ->get(route('settings.alerts.index'))
+ ->assertForbidden();
+ }
+
+}