35 lines
1.1 KiB
PHP
35 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Tests;
|
|
|
|
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
|
|
|
abstract class TestCase extends BaseTestCase
|
|
{
|
|
protected function setUp(): void
|
|
{
|
|
// HARD override: never let tests touch the dev MySQL — even if
|
|
// phpunit.xml env section is ignored by the runner.
|
|
putenv('DB_CONNECTION=sqlite');
|
|
putenv('DB_DATABASE=:memory:');
|
|
$_ENV['DB_CONNECTION'] = 'sqlite';
|
|
$_ENV['DB_DATABASE'] = ':memory:';
|
|
$_SERVER['DB_CONNECTION'] = 'sqlite';
|
|
$_SERVER['DB_DATABASE'] = ':memory:';
|
|
|
|
parent::setUp();
|
|
|
|
// Belt-and-braces: force the resolved config to sqlite memory.
|
|
config([
|
|
'database.default' => 'sqlite',
|
|
'database.connections.sqlite' => [
|
|
'driver' => 'sqlite',
|
|
'url' => null,
|
|
'database' => ':memory:',
|
|
'prefix' => '',
|
|
'foreign_key_constraints' => true,
|
|
],
|
|
]);
|
|
}
|
|
}
|