Skip to content

A free open source IT asset/license management system

Add test helpers

Marcus Moore6e37f945ac08
diff --git a/tests/Feature/Settings/AlertsSettingTest.php b/tests/Feature/Settings/AlertsSettingTest.php
index 6dae959648..42974d6640 100644
--- a/tests/Feature/Settings/AlertsSettingTest.php
+++ b/tests/Feature/Settings/AlertsSettingTest.php
@@ -47,7 +47,7 @@ class AlertsSettingTest extends TestCase
public function test_can_update_admin_cc_always_to_false()
{
- $this->settings->enableAdminCCAlways();
+ $this->settings->enableAdminCC()->enableAdminCCAlways();
$this->actingAs(User::factory()->superuser()->create())
->post(route('settings.alerts.save', ['admin_cc_always' => '0']));
diff --git a/tests/Support/Settings.php b/tests/Support/Settings.php
index bcbd83d8b6..d33970e683 100644
--- a/tests/Support/Settings.php
+++ b/tests/Support/Settings.php
@@ -4,6 +4,7 @@ namespace Tests\Support;
use App\Models\Setting;
use Illuminate\Support\Facades\Crypt;
+use RuntimeException;
class Settings
{
@@ -60,6 +61,24 @@ class Settings
]);
}
+ public function enableAdminCCAlways(): Settings
+ {
+ if (is_null($this->setting->admin_cc_email) || $this->setting->admin_cc_email == 0) {
+ throw new RuntimeException('admin_cc_email requires admin_cc_email to be set.');
+ }
+
+ return $this->update([
+ 'admin_cc_always' => 1,
+ ]);
+ }
+
+ public function disableAdminCCAlways(): Settings
+ {
+ return $this->update([
+ 'admin_cc_always' => 0,
+ ]);
+ }
+
public function enableMultipleFullCompanySupport(): Settings
{
return $this->update(['full_multiple_companies_support' => 1]);