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

The outcome of running one test target.

The status is "passed", "failed", "error" or "unverified"; only "passed" with at least one executed test verifies a specification.

Reporting two passing data-provider casesdoctest
(new \Requirements\Test\TestResult('passed', 2))->toArray() // => ['status' => 'passed', 'tests' => 2, 'message' => '']

Properties§

public string $status
public int $tests
public string $message = ''

Methods§

public function __construct(
    public string $status,
    public int $tests,
    public string $message = '',
)

Parameters

$statusstringThe verdict of the run
$testsintThe number of executed test cases
$messagestringWhy the run did not pass, or an empty string
public function toArray(): array{status: string, tests: int, message: string}

Returns the result as a JSON-ready record.

Returns

array{status: string, tests: int, message: string} The status, executed tests and message
Test cases 2

Test cases 12§

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

Dedicated tests 2
Other tests reaching this symbol 10

Relations§

Instantiated in 10
Type declarations 5