Skip to content

Commit

Permalink
[10.x] Test Improvements (#47709)
Browse files Browse the repository at this point in the history
* [10.x] Test Improvements

fixes failing tests.

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>

* wip

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>

---------

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed Jul 11, 2023
1 parent 33ca6fc commit 5985650
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions tests/Integration/Testing/TestWithoutDatabaseParallelTest.php
Expand Up @@ -13,16 +13,33 @@ protected function getPackageProviders($app)
return [ParallelTestingServiceProvider::class];
}

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

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

$this->beforeApplicationDestroyed(function () {
unset(
$_SERVER['LARAVEL_PARALLEL_TESTING'],
$_SERVER['LARAVEL_PARALLEL_TESTING_WITHOUT_DATABASES'],
$_SERVER['TEST_TOKEN'],
);
});
}

public function testRunningParallelTestWithoutDatabaseShouldNotCrashOnDefaultConnection()
{
// We should not create a database connection to check if it's SQLite or not.
ParallelTesting::callSetUpProcessCallbacks();
}
Expand Down

0 comments on commit 5985650

Please sign in to comment.