mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
WIP
This commit is contained in:
committed by
Nuno Maduro
parent
757a98230e
commit
b7ec3c59b8
@ -77,7 +77,7 @@ $bootPest = (static function (): void {
|
|||||||
|
|
||||||
$bootPest();
|
$bootPest();
|
||||||
|
|
||||||
(new CallsHandleArguments())($phpunitArgv);
|
$phpunitArgv = (new CallsHandleArguments())($phpunitArgv);
|
||||||
|
|
||||||
$application = new ApplicationForWrapperWorker(
|
$application = new ApplicationForWrapperWorker(
|
||||||
$phpunitArgv,
|
$phpunitArgv,
|
||||||
|
|||||||
@ -29,13 +29,18 @@ final class Parallel implements HandlesArguments
|
|||||||
Parallel\Handlers\Laravel::class,
|
Parallel\Handlers\Laravel::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public static function isInParallelProcess(): bool
|
||||||
|
{
|
||||||
|
return (int) Arr::get($_SERVER, 'PARATEST') === 1;
|
||||||
|
}
|
||||||
|
|
||||||
public function handleArguments(array $arguments): array
|
public function handleArguments(array $arguments): array
|
||||||
{
|
{
|
||||||
if ($this->argumentsContainParallelFlags($arguments)) {
|
if ($this->argumentsContainParallelFlags($arguments)) {
|
||||||
exit($this->runTestSuiteInParallel($arguments));
|
exit($this->runTestSuiteInParallel($arguments));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((int) Arr::get($_SERVER, 'PARATEST') === 1) {
|
if (self::isInParallelProcess()) {
|
||||||
return $this->runSubprocessHandlers($arguments);
|
return $this->runSubprocessHandlers($arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,19 +2,32 @@
|
|||||||
|
|
||||||
namespace Pest\Plugins\Parallel\Handlers;
|
namespace Pest\Plugins\Parallel\Handlers;
|
||||||
|
|
||||||
|
use Pest\Contracts\Plugins\HandlesArguments;
|
||||||
use Pest\Plugins\Concerns\HandleArguments;
|
use Pest\Plugins\Concerns\HandleArguments;
|
||||||
use Pest\Plugins\Parallel\Contracts\HandlesSubprocessArguments;
|
use Pest\Plugins\Parallel\Contracts\HandlesSubprocessArguments;
|
||||||
use Pest\TestCaseMethodFilters\TodoTestCaseFilter;
|
use Pest\Plugins\Retry;
|
||||||
use Pest\TestSuite;
|
|
||||||
|
|
||||||
final class Pest implements HandlesSubprocessArguments
|
final class Pest implements HandlesArguments, HandlesSubprocessArguments
|
||||||
{
|
{
|
||||||
use HandleArguments;
|
use HandleArguments;
|
||||||
|
|
||||||
|
public function handleArguments(array $arguments): array
|
||||||
|
{
|
||||||
|
if (Retry::$retrying) {
|
||||||
|
$_ENV['PEST_RETRY'] = '1';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $arguments;
|
||||||
|
}
|
||||||
|
|
||||||
public function handleSubprocessArguments(array $arguments): array
|
public function handleSubprocessArguments(array $arguments): array
|
||||||
{
|
{
|
||||||
$_SERVER['PEST_PARALLEL'] = '1';
|
$_SERVER['PEST_PARALLEL'] = '1';
|
||||||
|
|
||||||
|
if (isset($_SERVER['PEST_RETRY'])) {
|
||||||
|
Retry::$retrying = true;
|
||||||
|
}
|
||||||
|
|
||||||
return $arguments;
|
return $arguments;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user