0 follower

Class Yiisoft\Yii\Debug\Api\Inspector\Test\PHPUnitJSONReporter

InheritanceYiisoft\Yii\Debug\Api\Inspector\Test\PHPUnitJSONReporter
ImplementsPHPUnit\TextUI\ResultPrinter

Constants

Hide inherited 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

Hide inherited methods

__construct() public method

public __construct( ): mixed

                public function __construct()
{
    $this->prettifier = new NamePrettifier();
}

            
addError() public method

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);
}

            
addFailure() public method

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);
}

            
addIncompleteTest() public method

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);
}

            
addRiskyTest() public method

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);
}

            
addSkippedTest() public method

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);
}

            
addWarning() public method

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);
}

            
endTest() public method

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' => [],
    ];
}

            
endTestSuite() public method

public endTestSuite( \PHPUnit\Framework\TestSuite $suite ): void
$suite \PHPUnit\Framework\TestSuite

                public function endTestSuite(TestSuite $suite): void
{
}

            
printResult() public method

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)
    );
}

            
startTest() public method

public startTest( \PHPUnit\Framework\Test $test ): void
$test \PHPUnit\Framework\Test

                public function startTest(Test $test): void
{
}

            
startTestSuite() public method

public startTestSuite( \PHPUnit\Framework\TestSuite $suite ): void
$suite \PHPUnit\Framework\TestSuite

                public function startTestSuite(TestSuite $suite): void
{
}

            
write() public method

public write( string $buffer ): void
$buffer string

                public function write(string $buffer): void
{
    $this->data = [];
}