final class ProcessRunner
Public API: explicitly declared with @visibility public.

Runs a runner command that writes JUnit XML and reads the verdict from its reports.

The arguments are appended to the configured command without a shell, the reports are written to a fresh temporary directory and removed afterwards. A process that cannot start or exceeds its timeout becomes an "error" result.

Running a command that reports one passing test casedoctest
$config = new \Requirements\Test\RunnerConfig('custom', [PHP_BINARY, '-r', 'file_put_contents($argv[1], "<testsuite><testcase name=\"a\"/></testsuite>");'], sys_get_temp_dir());
    $result = (new \Requirements\Test\ProcessRunner())->run($config, static fn (string $directory): array => [$directory . '/report.xml']);
    [$result->status, $result->tests] // => ['passed', 1]

Methods§

public function run(RunnerConfig $config, callable(string): list<string> $arguments): TestResult

Runs the command and reads the JUnit reports it wrote.

Parameters

$configRunnerConfigThe command, working directory and timeout
$argumentscallable(string): list<string>Builds the arguments from the report directory

Returns

TestResult The verdict read from the reports

Throws

RuntimeException When the temporary report directory cannot be created
Test cases 10
Called from 2
Calls 16

Test cases 13§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 10
Other tests reaching this symbol 3

Relations§

Instantiated in 2
Method calls 2