Skip to content

Commit 5985650

Browse files
authored
[10.x] Test Improvements (#47709)
* [10.x] Test Improvements fixes failing tests. Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> --------- Signed-off-by: Mior Muhammad Zaki <[email protected]>
1 parent 33ca6fc commit 5985650

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

tests/Integration/Testing/TestWithoutDatabaseParallelTest.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,33 @@ protected function getPackageProviders($app)
1313
return [ParallelTestingServiceProvider::class];
1414
}
1515

16-
public function testRunningParallelTestWithoutDatabaseShouldNotCrashOnDefaultConnection()
16+
/**
17+
* Define the test environment.
18+
*
19+
* @param \Illuminate\Foundation\Application $app
20+
* @return void
21+
*/
22+
protected function defineEnvironment($app)
1723
{
1824
// Given an application that does not use database connections at all
19-
$this->app['config']->set('database.default', null);
25+
$app['config']->set('database.default', null);
2026

2127
// When we run parallel testing with `without-databases` option
2228
$_SERVER['LARAVEL_PARALLEL_TESTING'] = 1;
2329
$_SERVER['LARAVEL_PARALLEL_TESTING_WITHOUT_DATABASES'] = 1;
2430
$_SERVER['TEST_TOKEN'] = '1';
2531

32+
$this->beforeApplicationDestroyed(function () {
33+
unset(
34+
$_SERVER['LARAVEL_PARALLEL_TESTING'],
35+
$_SERVER['LARAVEL_PARALLEL_TESTING_WITHOUT_DATABASES'],
36+
$_SERVER['TEST_TOKEN'],
37+
);
38+
});
39+
}
40+
41+
public function testRunningParallelTestWithoutDatabaseShouldNotCrashOnDefaultConnection()
42+
{
2643
// We should not create a database connection to check if it's SQLite or not.
2744
ParallelTesting::callSetUpProcessCallbacks();
2845
}

0 commit comments

Comments
 (0)