Class Yiisoft\Yii\Debug\Api\Inspector\Test\PHPUnitJSONReporter
| Inheritance | Yiisoft\Yii\Debug\Api\Inspector\Test\PHPUnitJSONReporter |
|---|---|
| Implements | PHPUnit\TextUI\ResultPrinter |
Public Methods
Constants
| Constant | Value | Description | Defined By |
|---|---|---|---|
| ENVIRONMENT_VARIABLE_DIRECTORY_NAME | 'REPORTER_OUTPUT_PATH' | Yiisoft\Yii\Debug\Api\Inspector\Test\PHPUnitJSONReporter | |
| FILENAME | 'phpunit-report.json' | Yiisoft\Yii\Debug\Api\Inspector\Test\PHPUnitJSONReporter |
Method Details
| public __construct( ): mixed |
public function __construct()
{
$this->prettifier = new NamePrettifier();
}
| public addError( \PHPUnit\Framework\Test $test, Throwable $t, float $time ): void | ||
| $test | \PHPUnit\Framework\Test | |
| $t | Throwable | |
| $time | float | |
public function addError(Test $test, Throwable $t, float $time): void
{
$this->logErroredTest($test, $t);
}
| public addFailure( \PHPUnit\Framework\Test $test, \PHPUnit\Framework\AssertionFailedError $e, float $time ): void | ||
| $test | \PHPUnit\Framework\Test | |
| $e | \PHPUnit\Framework\AssertionFailedError | |
| $time | float | |
public function addFailure(Test $test, AssertionFailedError $e, float $time): void
{
$this->logErroredTest($test, $e);
}
| public addIncompleteTest( \PHPUnit\Framework\Test $test, Throwable $t, float $time ): void | ||
| $test | \PHPUnit\Framework\Test | |
| $t | Throwable | |
| $time | float | |
public function addIncompleteTest(Test $test, Throwable $t, float $time): void
{
$this->logErroredTest($test, $t);
}
| public addRiskyTest( \PHPUnit\Framework\Test $test, Throwable $t, float $time ): void | ||
| $test | \PHPUnit\Framework\Test | |
| $t | Throwable | |
| $time | float | |
public function addRiskyTest(Test $test, Throwable $t, float $time): void
{
$this->logErroredTest($test, $t);
}
| public addSkippedTest( \PHPUnit\Framework\Test $test, Throwable $t, float $time ): void | ||
| $test | \PHPUnit\Framework\Test | |
| $t | Throwable | |
| $time | float | |
public function addSkippedTest(Test $test, Throwable $t, float $time): void
{
$this->logErroredTest($test, $t);
}
| public addWarning( \PHPUnit\Framework\Test $test, \PHPUnit\Framework\Warning $e, float $time ): void | ||
| $test | \PHPUnit\Framework\Test | |
| $e | \PHPUnit\Framework\Warning | |
| $time | float | |
public function addWarning(Test $test, Warning $e, float $time): void
{
$this->logErroredTest($test, $e);
}
| public endTest( \PHPUnit\Framework\Test $test, float $time ): void | ||
| $test | \PHPUnit\Framework\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 endTestSuite( \PHPUnit\Framework\TestSuite $suite ): void | ||
| $suite | \PHPUnit\Framework\TestSuite | |
public function endTestSuite(TestSuite $suite): void
{
}
| public printResult( \PHPUnit\Framework\TestResult $result ): void | ||
| $result | \PHPUnit\Framework\TestResult | |
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 startTest( \PHPUnit\Framework\Test $test ): void | ||
| $test | \PHPUnit\Framework\Test | |
public function startTest(Test $test): void
{
}
| public startTestSuite( \PHPUnit\Framework\TestSuite $suite ): void | ||
| $suite | \PHPUnit\Framework\TestSuite | |
public function startTestSuite(TestSuite $suite): void
{
}
Signup or Login in order to comment.