mirror of
https://github.com/pestphp/pest.git
synced 2026-03-11 02:07:23 +01:00
WIP
This commit is contained in:
committed by
Nuno Maduro
parent
d69f61c8d3
commit
48309931ef
37
src/Plugins/Parallel/Handlers/Laravel.php
Normal file
37
src/Plugins/Parallel/Handlers/Laravel.php
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user