This commit is contained in:
Luke Downing
2023-02-06 16:43:58 +00:00
committed by Nuno Maduro
parent d69f61c8d3
commit 48309931ef
6 changed files with 459 additions and 1 deletions

View File

@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace Pest\Plugins\Parallel\Handlers;
use Pest\Plugins\Concerns\HandleArguments;
/**
* @internal
*/
final class Laravel
{
use HandleArguments;
public function handle(array $args): array
{
if (! self::isALaravelApplication()) {
return $args;
}
foreach ($args as $value) {
if (str_starts_with($value, '--runner')) {
$args = $this->popArgument($value, $args);
}
}
return $this->pushArgument('--runner=\Illuminate\Testing\ParallelRunner', $args);
}
private static function isALaravelApplication(): bool
{
return class_exists(\Illuminate\Foundation\Application::class)
&& class_exists(\Illuminate\Testing\ParallelRunner::class)
&& !class_exists(\Orchestra\Testbench\TestCase::class);
}
}