@@ -274,7 +274,9 @@ function ${options.relativeFunctionName}(string $path, string $${options.rootPar
274274
275275function phpunitArgsPhp ( functionName : string , logFunction : string ) : string {
276276 return `function ${ functionName } (array $argv) {
277- $arguments = array('colors' => 'never', 'testdox' => true, 'verbose' => false, 'extensions' => array());
277+ // PHPUnit otherwise writes .phpunit.result.cache relative to the mounted
278+ // plugin working directory. Readonly mounts must not acquire that side effect.
279+ $arguments = array('colors' => 'never', 'testdox' => true, 'verbose' => false, 'extensions' => array(), 'cacheResult' => false);
278280 $args = array_slice($argv, 1);
279281 for ($i = 0; $i < count($args); $i++) {
280282 $arg = $args[$i];
@@ -300,6 +302,18 @@ function phpunitArgsPhp(functionName: string, logFunction: string): string {
300302 $arguments['verbose'] = true;
301303 continue;
302304 }
305+ if ($arg === '--cache-result-file' && isset($args[$i + 1]) && $args[$i + 1] !== '') {
306+ $arguments['cacheResult'] = true;
307+ $arguments['cacheResultFile'] = $args[++$i];
308+ ${ logFunction } ('NOTICE:phpunit result cache redirected to: ' . $arguments['cacheResultFile']);
309+ continue;
310+ }
311+ if (strpos($arg, '--cache-result-file=') === 0 && substr($arg, strlen('--cache-result-file=')) !== '') {
312+ $arguments['cacheResult'] = true;
313+ $arguments['cacheResultFile'] = substr($arg, strlen('--cache-result-file='));
314+ ${ logFunction } ('NOTICE:phpunit result cache redirected to: ' . $arguments['cacheResultFile']);
315+ continue;
316+ }
303317 }
304318 return $arguments;
305319}`
0 commit comments