Skip to content

Commit 0eaf9ea

Browse files
committed
Fix testing flow
1 parent 8ae8e9d commit 0eaf9ea

File tree

5 files changed

+16
-13
lines changed

5 files changed

+16
-13
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
},
3838
"autoload-dev": {
3939
"classmap": [
40-
"tests/database/factories"
40+
"tests/database/factories",
41+
"tests/database/seeds"
4142
],
4243
"psr-4": {
4344
"GeneaLabs\\LaravelModelCaching\\Tests\\": "tests/"

phpunit.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
stopOnFailure="true"
1212
>
1313
<testsuites>
14+
<testsuite name="Setup">
15+
<directory>./tests/AlwaysRunFirstTest.php</directory>
16+
</testsuite>
1417
<testsuite name="Feature">
1518
<directory suffix="Test.php">./tests/Feature</directory>
1619
</testsuite>

tests/AlwaysRunFirstTest.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ public function setUp() : void
1010
{
1111
parent::setUp();
1212

13+
$this->app['config']->set('database.default', 'baseline');
14+
$this->app['config']->set('database.connections.baseline', [
15+
'driver' => 'sqlite',
16+
"url" => null,
17+
'database' => __DIR__ . '/database/baseline.sqlite',
18+
'prefix' => '',
19+
"foreign_key_constraints" => false,
20+
]);
21+
1322
$this->createBaselineSqliteDatabase();
1423

1524
$this->withFactories(__DIR__ . '/database/factories');
@@ -26,21 +35,11 @@ public function setUp() : void
2635
->run();
2736
}
2837

29-
protected function getEnvironmentSetUp($app)
38+
private function createBaselineSqliteDatabase()
3039
{
31-
parent::getEnvironmentSetUp($app);
32-
33-
$app['config']->set('database.default', 'baseline');
34-
$app['config']->set('database.connections.baseline', [
35-
'driver' => 'sqlite',
36-
"url" => null,
37-
'database' => __DIR__ . '/database/baseline.sqlite',
38-
'prefix' => '',
39-
"foreign_key_constraints" => false,
40-
]);
40+
shell_exec("cd " . __DIR__ . "/database && rm *.sqlite && touch baseline.sqlite");
4141
}
4242

43-
4443
/** @test */
4544
public function migrateAndInstallTheDatabase()
4645
{

tests/database/baseline.sqlite

8 KB
Binary file not shown.

tests/database/testing.sqlite

8 KB
Binary file not shown.

0 commit comments

Comments
 (0)