0 follower

Final Class Yiisoft\Yii\Debug\Api\Inspector\Test\CodeceptionJSONReporter

InheritanceYiisoft\Yii\Debug\Api\Inspector\Test\CodeceptionJSONReporter » Codeception\Extension

Constants

Hide inherited constants

Constant Value Description Defined By
FILENAME 'codeception-report.json' Yiisoft\Yii\Debug\Api\Inspector\Test\CodeceptionJSONReporter

Property Details

Hide inherited properties

$config protected property
protected array $config = [
    
'output-path' => __DIR__,
]
$events public static property
public static array $events = [
    \
Codeception\Events::TEST_SUCCESS => 'success',
    \
Codeception\Events::TEST_FAIL => 'fail',
    \
Codeception\Events::TEST_ERROR => 'error',
    \
Codeception\Events::RESULT_PRINT_AFTER => 'all',
]

Method Details

Hide inherited methods

_initialize() public method

public void _initialize ( )

                public function _initialize(): void
{
    $this->_reconfigure(['settings' => ['silent' => true]]);
}

            
all() public method

public void all ( \Codeception\Event\PrintResultEvent $event )
$event \Codeception\Event\PrintResultEvent

                public function all(PrintResultEvent $event): void
{
    file_put_contents(
        $this->config['output-path'] . DIRECTORY_SEPARATOR . self::FILENAME,
        json_encode($this->data, JSON_THROW_ON_ERROR)
    );
}

            
error() public method

public void error ( \Codeception\Event\FailEvent $event )
$event \Codeception\Event\FailEvent

                public function error(FailEvent $event): void
{
    $this->data[] = [
        'file' => $this->getTestFilename($event),
        'test' => $this->getTestName($event),
        'time' => $event->getTime(),
        'status' => 'error',
        'stacktrace' => $event->getFail()->getTrace(),
    ];
}

            
fail() public method

public void fail ( \Codeception\Event\FailEvent $event )
$event \Codeception\Event\FailEvent

                public function fail(FailEvent $event): void
{
    $this->data[] = [
        'file' => $this->getTestFilename($event),
        'test' => $this->getTestName($event),
        'time' => $event->getTime(),
        'status' => 'fail',
        'stacktrace' => $event->getFail()->getTrace(),
    ];
}

            
success() public method

public void success ( \Codeception\Event\TestEvent $event )
$event \Codeception\Event\TestEvent

                public function success(TestEvent $event): void
{
    $this->data[] = [
        'file' => $this->getTestFilename($event),
        'test' => $this->getTestName($event),
        'time' => $event->getTime(),
        'status' => 'ok',
        'stacktrace' => [],
    ];
}