Skip to content

Commit

Permalink
[8.x] Update the ParallelRunner to allow for a custom Runner to b…
Browse files Browse the repository at this point in the history
…e resolved (#38374)

* Updates the `ParallelRunner` to allow for a custom `Runner` to be resolved instead of the default in Collision.

* Update src/Illuminate/Testing/ParallelRunner.php

Co-authored-by: Nuno Maduro <[email protected]>

* Update src/Illuminate/Testing/ParallelRunner.php

Co-authored-by: Nuno Maduro <[email protected]>

Co-authored-by: Nuno Maduro <[email protected]>
  • Loading branch information
lukeraymonddowning and nunomaduro authored Aug 13, 2021
1 parent fc0a4a7 commit 2d8836d
Showing 1 changed file with 23 additions and 1 deletion.
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

0 comments on commit 2d8836d

Please sign in to comment.