Skip to content

Commit 2d8836d

Browse files
[8.x] Update the ParallelRunner to allow for a custom Runner to be 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]>
1 parent fc0a4a7 commit 2d8836d

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/Illuminate/Testing/ParallelRunner.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ class ParallelRunner implements RunnerInterface
2121
*/
2222
protected static $applicationResolver;
2323

24+
/**
25+
* The runner resolver callback.
26+
*
27+
* @var \Closure|null
28+
*/
29+
protected static $runnerResolver;
30+
2431
/**
2532
* The original test runner options.
2633
*
@@ -57,7 +64,11 @@ public function __construct(Options $options, OutputInterface $output)
5764
$output = new ParallelConsoleOutput($output);
5865
}
5966

60-
$this->runner = new WrapperRunner($options, $output);
67+
$runnerResolver = static::$runnerResolver ?: function (Options $options, OutputInterface $output) {
68+
return new WrapperRunner($options, $output);
69+
};
70+
71+
$this->runner = call_user_func($runnerResolver, $options, $output);
6172
}
6273

6374
/**
@@ -71,6 +82,17 @@ public static function resolveApplicationUsing($resolver)
7182
static::$applicationResolver = $resolver;
7283
}
7384

85+
/**
86+
* Set the runner resolver callback.
87+
*
88+
* @param \Closure|null $resolver
89+
* @return void
90+
*/
91+
public static function resolveRunnerUsing($resolver)
92+
{
93+
static::$runnerResolver = $resolver;
94+
}
95+
7496
/**
7597
* Runs the test suite.
7698
*

0 commit comments

Comments
 (0)