A free open source IT asset/license management system
Move initialization of settings to trait
Marcus Moore473241edca99
diff --git a/tests/Support/InteractsWithSettings.php b/tests/Support/InteractsWithSettings.phpindex 0a7a9c53b6..1de9e7bc13 100644--- a/tests/Support/InteractsWithSettings.php+++ b/tests/Support/InteractsWithSettings.php@@ -4,5 +4,10 @@ namespace Tests\Support;trait InteractsWithSettings{+ protected Settings $settings;+ public function setUpSettings()+ {+ $this->settings = Settings::initialize();+ }}diff --git a/tests/TestCase.php b/tests/TestCase.phpindex c8dd661787..e3fd8a7aa4 100644--- a/tests/TestCase.php+++ b/tests/TestCase.php@@ -6,15 +6,12 @@ use App\Http\Middleware\SecurityHeaders;use Illuminate\Foundation\Testing\LazilyRefreshDatabase;use Illuminate\Foundation\Testing\TestCase as BaseTestCase;use Tests\Support\InteractsWithSettings;-use Tests\Support\Settings;abstract class TestCase extends BaseTestCase{use CreatesApplication;use LazilyRefreshDatabase;- protected Settings $settings;-private array $globallyDisabledMiddleware = [SecurityHeaders::class,];@@ -25,8 +22,8 @@ abstract class TestCase extends BaseTestCase$this->withoutMiddleware($this->globallyDisabledMiddleware);- if (in_array(InteractsWithSettings::class, class_uses_recursive($this))) {- $this->settings = Settings::initialize();+ if (collect(class_uses_recursive($this))->contains(InteractsWithSettings::class)) {+ $this->setUpSettings();}}}