Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Update the ParallelRunner to allow for a custom Runner to be resolved #38374

Merged
merged 3 commits into from
Aug 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion src/Illuminate/Testing/ParallelRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ class ParallelRunner implements RunnerInterface
*/
protected static $applicationResolver;

/**
* The runner resolver callback.
*
* @var \Closure|null
*/
protected static $runnerResolver;

/**
* The original test runner options.
*
Expand Down Expand Up @@ -57,7 +64,11 @@ public function __construct(Options $options, OutputInterface $output)
$output = new ParallelConsoleOutput($output);
}

$this->runner = new WrapperRunner($options, $output);
$runnerResolver = static::$runnerResolver ?: function (Options $options, OutputInterface $output) {
return new WrapperRunner($options, $output);
};

$this->runner = call_user_func($runnerResolver, $options, $output);
}

/**
Expand All @@ -71,6 +82,17 @@ public static function resolveApplicationUsing($resolver)
static::$applicationResolver = $resolver;
}

/**
* Set the runner resolver callback.
*
* @param \Closure|null $resolver
* @return void
*/
public static function resolveRunnerUsing($resolver)
{
static::$runnerResolver = $resolver;
}

/**
* Runs the test suite.
*
Expand Down