Guard against wiping database when running tests and test specific envs are not created

This commit is contained in:
Marcus Moore
2023-07-11 12:14:42 -07:00
parent 4845a88c68
commit 48e4ec8cf5
3 changed files with 17 additions and 1 deletions
+7
View File
@@ -7,6 +7,7 @@ use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Laravel\Dusk\TestCase as BaseTestCase;
use RuntimeException;
abstract class DuskTestCase extends BaseTestCase
{
@@ -21,6 +22,12 @@ abstract class DuskTestCase extends BaseTestCase
*/
public static function prepare()
{
if (!file_exists(realpath(__DIR__ . '/../') . '/.env.dusk.local')) {
throw new RuntimeException(
'.env.dusk.local file does not exist. Aborting to avoid wiping your local database'
);
}
if (! static::runningInSail()) {
static::startChromeDriver();
}