Skip to content

A free open source IT asset/license management system

Extract method

Marcus Moorea28bee86ba1b
diff --git a/tests/TestCase.php b/tests/TestCase.php
index 9bb7f56e17..f9f4dbae58 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -24,11 +24,7 @@ abstract class TestCase extends BaseTestCase
protected function setUp(): void
{
- if (!file_exists(realpath(__DIR__ . '/../') . '/.env.testing')) {
- throw new RuntimeException(
- '.env.testing file does not exist. Aborting to avoid wiping your local database'
- );
- }
+ $this->guardAgainstMissingEnv();
parent::setUp();
@@ -38,4 +34,13 @@ abstract class TestCase extends BaseTestCase
$this->initializeSettings();
}
+
+ private function guardAgainstMissingEnv(): void
+ {
+ if (!file_exists(realpath(__DIR__ . '/../') . '/.env.testing')) {
+ throw new RuntimeException(
+ '.env.testing file does not exist. Aborting to avoid wiping your local database.'
+ );
+ }
+ }
}