Skip to content

Commit

Permalink
allow trait to be moved
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jan 30, 2021
1 parent 44e5d47 commit 1c11b78
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/Illuminate/Testing/ParallelRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

namespace Illuminate\Testing;

use Illuminate\Contracts\Console\Kernel;
use Illuminate\Support\Facades\ParallelTesting;
use ParaTest\Runners\PHPUnit\Options;
use ParaTest\Runners\PHPUnit\RunnerInterface;
use ParaTest\Runners\PHPUnit\WrapperRunner;
use PHPUnit\TextUI\XmlConfiguration\PhpHandler;
use RuntimeException;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\OutputInterface;

Expand Down Expand Up @@ -128,13 +130,23 @@ protected function forEachProcess($callback)
protected function createApplication()
{
$applicationResolver = static::$applicationResolver ?: function () {
$applicationCreator = new class {
use \Tests\CreatesApplication;
};
if (trait_exists(\Tests\CreatesApplication::class)) {
$applicationCreator = new class {
use \Tests\CreatesApplication;
};

return $applicationCreator->createApplication();
return $applicationCreator->createApplication();
} elseif (file_exists(getcwd().'/bootstrap/app.php')) {
$app = require getcwd().'/bootstrap/app.php';

$app->make(Kernel::class)->bootstrap();

return $app;
}

throw new RuntimeException('Parallel Runner unable to resolve application.');
};

return call_user_func($applicationResolver);
}
}
}

0 comments on commit 1c11b78

Please sign in to comment.