Skip to content

Commit 94bfdcc

Browse files
committed
Move default database config setup to DatabaseTest
1 parent 14f586e commit 94bfdcc

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

tests/Checks/BasePreflightCheck.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Kirschbaum\PreflightChecks\Tests\Checks;
44

55
use Orchestra\Testbench\TestCase;
6-
use Illuminate\Contracts\Config\Repository;
76
use Kirschbaum\PreflightChecks\Checks\Result;
87
use Kirschbaum\PreflightChecks\Checks\PreflightCheck;
98
use Kirschbaum\PreflightChecks\PreflightChecksServiceProvider;
@@ -18,24 +17,6 @@ abstract class BasePreflightCheck extends TestCase
1817
*/
1918
protected $preflightCheckClass;
2019

21-
/**
22-
* Define environment setup.
23-
*
24-
* @param \Illuminate\Foundation\Application $app
25-
* @return void
26-
*/
27-
protected function defineEnvironment($app)
28-
{
29-
// Setup default database to use sqlite :memory:
30-
tap($app['config'], function (Repository $config) {
31-
$config->set('database.connections.test_default', [
32-
'driver' => 'sqlite',
33-
'database' => ':memory:',
34-
'prefix' => '',
35-
]);
36-
});
37-
}
38-
3920
public function checkConfigValues(PreflightCheck $preflightCheck)
4021
{
4122
$config = $this->getProtectedProperty($preflightCheck, 'requiredConfig');

tests/Checks/DatabaseTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ protected function setUp(): void
2222
parent::setUp();
2323

2424
config(['database.default' => static::TEST_DEFAULT_DB_CONNECTION]);
25+
config([
26+
'database.connections.' . static::TEST_DEFAULT_DB_CONNECTION => [
27+
'driver' => 'sqlite',
28+
'database' => ':memory:',
29+
'prefix' => '',
30+
],
31+
]);
2532
}
2633

2734
/**
@@ -68,7 +75,7 @@ public static function providesDatabaseScenarios()
6875
];
6976

7077
yield 'Default checks default' => [
71-
['connection' => static::TEST_DEFAULT_DB_CONNECTION, 'driver' => 'sqlite', 'database' => ':memory:'],
78+
['connection' => static::TEST_DEFAULT_DB_CONNECTION],
7279
static::TEST_DEFAULT_DB_CONNECTION,
7380
];
7481

0 commit comments

Comments
 (0)