Class Yiisoft\Yii\Debug\Api\Inspector\Command\CodeceptionCommand
| Inheritance | Yiisoft\Yii\Debug\Api\Inspector\Command\CodeceptionCommand |
|---|---|
| Implements | Yiisoft\Yii\Debug\Api\Inspector\CommandInterface |
Public Methods
Constants
| Constant | Value | Description | Defined By |
|---|---|---|---|
| COMMAND_NAME | 'test/codeception' | Yiisoft\Yii\Debug\Api\Inspector\Command\CodeceptionCommand |
Method Details
| public mixed __construct ( \Yiisoft\Aliases\Aliases $aliases ) | ||
| $aliases | \Yiisoft\Aliases\Aliases | |
public function __construct(private Aliases $aliases)
{
}
| public static string getDescription ( ) |
public static function getDescription(): string
{
return '';
}
| public static string getTitle ( ) |
public static function getTitle(): string
{
return 'Codeception';
}
| public Yiisoft\Yii\Debug\Api\Inspector\CommandResponse run ( ) |
public function run(): CommandResponse
{
$projectDirectory = $this->aliases->get('@root');
$debugDirectory = $this->aliases->get('@runtime/debug');
$extension = CodeceptionJSONReporter::class;
$params = [
'vendor/bin/codecept',
'run',
'--silent',
'-e',
$extension,
'--override',
"extensions: config: {$extension}: output-path: {$debugDirectory}",
'-vvv',
];
$process = new Process($params);
$process
->setWorkingDirectory($projectDirectory)
->setTimeout(null)
->run();
$processOutput = json_decode(
file_get_contents($debugDirectory . DIRECTORY_SEPARATOR . CodeceptionJSONReporter::FILENAME),
true,
512,
JSON_THROW_ON_ERROR
);
if (!$process->getExitCode() > 1) {
return new CommandResponse(
status: CommandResponse::STATUS_FAIL,
result: null,
errors: array_filter([$processOutput, $process->getErrorOutput()]),
);
}
return new CommandResponse(
status: $process->isSuccessful() ? CommandResponse::STATUS_OK : CommandResponse::STATUS_ERROR,
result: $processOutput
);
}
Signup or Login in order to comment.