public function _initialize() { if (!isset($this->config['lint'])) { throw new Exception('missing [lint] object in codeception.yml'); } /* Options: -p <php> Specify PHP-CGI executable to run (default: 'php'). -s, --short Set short_open_tag to On (default: Off). -e <ext> Check only files with selected extensions separated by comma. (default: php,php3,php4,php5,phtml) --exclude Exclude directory. If you want exclude multiple directories, use multiple exclude parameters. --ignore-fails Ignore failed tests. */ try { $settings = Settings::parseArguments($this->config['lint']); $manager = new PhpParallelLint\Manager(); $result = $manager->run($settings); $hasError = $result->hasError(); $result = json_decode(json_encode($result)); teamcity_console_logger(MessageTemplate::BlockStart('ParallelLintTeamcityReporter')); teamcity_console_logger(MessageTemplate::TestSuiteStart('Errors')); foreach ($result->errors as $index => $error) { $type = $error->type . "[{$index}]"; teamcity_console_logger(MessageTemplate::TestStart($type . ' ~ ' . $error->file)); teamcity_console_logger(MessageTemplate::TestFailed($error->normalizeMessage, $error->message)); teamcity_console_logger(MessageTemplate::TestEnd($error->file)); } teamcity_console_logger(MessageTemplate::TestSuiteEnd('Errors')); teamcity_console_logger(MessageTemplate::BlockStart('FilesWithSyntaxError')); foreach ($result->filesWithSyntaxError as $index => $value) { $type = $error->type . "[{$index}]"; teamcity_console_logger(MessageTemplate::Log("[{$index}] - {$value}")); } teamcity_console_logger(MessageTemplate::BlockEnd('FilesWithSyntaxError')); teamcity_console_logger(MessageTemplate::BlockStart('CheckedFiles')); foreach ($result->checkedFiles as $index => $value) { $type = $error->type . "[{$index}]"; teamcity_console_logger(MessageTemplate::Log("[{$index}] - {$value}")); } teamcity_console_logger(MessageTemplate::BlockEnd('CheckedFiles')); teamcity_console_logger(MessageTemplate::BlockStart('SkippedFiles')); foreach ($result->skippedFiles as $index => $value) { $type = $error->type . "[{$index}]"; teamcity_console_logger(MessageTemplate::Log("[{$index}] - {$value}")); } teamcity_console_logger(MessageTemplate::BlockEnd('SkippedFiles')); teamcity_console_logger(MessageTemplate::BlockEnd('ParallelLintTeamcityReporter')); } catch (Exception $e) { echo $e->getMessage(), PHP_EOL; die(255); } }
public function stepFail(\Codeception\Event\StepEvent $e) { $name = get_class($e->getTest()); teamcity_console_logger(MessageTemplate::TestFailed($name, 'Step Failed')); }