Class Yiisoft\Yii\Debug\Api\Inspector\Test\PHPUnitJSONReporter
| Inheritance | Yiisoft\ |
|---|---|
| Implements | PHPUnit\ |
Public Methods
Constants
| Constant | Value | Description | Defined By |
|---|---|---|---|
| ENVIRONMENT_VARIABLE_DIRECTORY_NAME | 'REPORTER_OUTPUT_PATH' | Yiisoft\ |
|
| FILENAME | 'phpunit-report.json' | Yiisoft\ |
Method Details
| public mixed __construct ( ) |
public function __construct()
{
$this->prettifier = new NamePrettifier();
}
| public void addError ( \ | ||
| $test | \ |
|
| $t | Throwable | |
| $time | float | |
public function addError(Test $test, Throwable $t, float $time): void
{
$this->logErroredTest($test, $t);
}
| public void addFailure ( \ | ||
| $test | \ |
|
| $e | \ |
|
| $time | float | |
public function addFailure(Test $test, AssertionFailedError $e, float $time): void
{
$this->logErroredTest($test, $e);
}
| public void addIncompleteTest ( \ | ||
| $test | \ |
|
| $t | Throwable | |
| $time | float | |
public function addIncompleteTest(Test $test, Throwable $t, float $time): void
{
$this->logErroredTest($test, $t);
}
| public void addRiskyTest ( \ | ||
| $test | \ |
|
| $t | Throwable | |
| $time | float | |
public function addRiskyTest(Test $test, Throwable $t, float $time): void
{
$this->logErroredTest($test, $t);
}
| public void addSkippedTest ( \ | ||
| $test | \ |
|
| $t | Throwable | |
| $time | float | |
public function addSkippedTest(Test $test, Throwable $t, float $time): void
{
$this->logErroredTest($test, $t);
}
| public void addWarning ( \ | ||
| $test | \ |
|
| $e | \ |
|
| $time | float | |
public function addWarning(Test $test, Warning $e, float $time): void
{
$this->logErroredTest($test, $e);
}
| public void endTest ( \ | ||
| $test | \ |
|
| $time | float | |
public function endTest(Test $test, float $time): void
{
if (!$test instanceof TestCase) {
return;
}
if ($test->getStatus() !== BaseTestRunner::STATUS_PASSED) {
return;
}
$parsedName = $this->parseName($test);
$this->data[$parsedName] = [
'file' => $this->parseFilename($test),
'test' => $parsedName,
'status' => 'ok',
'stacktrace' => [],
];
}
| public void endTestSuite ( \ | ||
| $suite | \ |
|
public function endTestSuite(TestSuite $suite): void {}
| public void printResult ( \ | ||
| $result | \ |
|
public function printResult(TestResult $result): void
{
$path = getenv(self::ENVIRONMENT_VARIABLE_DIRECTORY_NAME) ?: getcwd();
ksort($this->data);
file_put_contents(
$path . DIRECTORY_SEPARATOR . self::FILENAME,
json_encode(array_values($this->data), JSON_THROW_ON_ERROR),
);
}
| public void startTest ( \ | ||
| $test | \ |
|
public function startTest(Test $test): void {}
| public void startTestSuite ( \ | ||
| $suite | \ |
|
public function startTestSuite(TestSuite $suite): void {}
User Contributed Notes
Leave a comment
Join the conversation to share a note.