-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[10.x] Fix parallel testing without any database connection (#47705)
* Fix parallel testing without any database connection * StyleCI
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
tests/Integration/Testing/TestWithoutDatabaseParallelTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Illuminate\Tests\Integration\Testing; | ||
|
||
use Illuminate\Support\Facades\ParallelTesting; | ||
use Illuminate\Testing\ParallelTestingServiceProvider; | ||
use Orchestra\Testbench\TestCase; | ||
|
||
class TestWithoutDatabaseParallelTest extends TestCase | ||
{ | ||
protected function getPackageProviders($app) | ||
{ | ||
return [ParallelTestingServiceProvider::class]; | ||
} | ||
|
||
public function testRunningParallelTestWithoutDatabaseShouldNotCrashOnDefaultConnection() | ||
{ | ||
// Given an application that does not use database connections at all | ||
$this->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'; | ||
|
||
// We should not create a database connection to check if it's SQLite or not. | ||
ParallelTesting::callSetUpProcessCallbacks(); | ||
} | ||
} |