本文整理汇总了PHP中PHPCI\Builder::logExecOutput方法的典型用法代码示例。如果您正苦于以下问题:PHP Builder::logExecOutput方法的具体用法?PHP Builder::logExecOutput怎么用?PHP Builder::logExecOutput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPCI\Builder
的用法示例。
在下文中一共展示了Builder::logExecOutput方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Run CasperJS tests.
* @return bool
*/
public function execute()
{
$this->phpci->logExecOutput(false);
$casperJs = $this->phpci->findBinary('casperjs');
if (!$casperJs) {
$this->phpci->logFailure(Lang::get('could_not_find', 'casperjs'));
return false;
}
$curdir = getcwd();
chdir($this->phpci->buildPath);
$cmd = $casperJs . " test {$this->tests_path} --xunit={$this->x_unit_file_path} {$this->arguments}";
$success = $this->phpci->executeCommand($cmd);
chdir($curdir);
$xUnitString = file_get_contents($this->x_unit_file_path);
try {
$xUnitParser = new XUnitParser($xUnitString);
$output = $xUnitParser->parse();
$failures = $xUnitParser->getTotalFailures();
} catch (\Exception $ex) {
$this->phpci->logFailure($xUnitParser);
throw $ex;
}
$this->build->storeMeta('casperJs-errors', $failures);
$this->build->storeMeta('casperJs-data', $output);
$this->phpci->logExecOutput(true);
return $success;
}
示例2: execute
/**
* Runs PHP Code Sniffer in a specified directory, to a specified standard.
*/
public function execute()
{
list($ignore, $standard, $suffixes) = $this->getFlags();
$phpcs = $this->phpci->findBinary('phpcs');
if (!$phpcs) {
$this->phpci->logFailure('Could not find phpcs.');
return false;
}
$this->phpci->logExecOutput(false);
$cmd = $phpcs . ' --report=json %s %s %s %s %s "%s"';
$this->phpci->executeCommand($cmd, $standard, $suffixes, $ignore, $this->tab_width, $this->encoding, $this->phpci->buildPath . $this->path);
$output = $this->phpci->getLastOutput();
list($errors, $warnings, $data) = $this->processReport($output);
$this->phpci->logExecOutput(true);
$success = true;
$this->build->storeMeta('phpcs-warnings', $warnings);
$this->build->storeMeta('phpcs-errors', $errors);
$this->build->storeMeta('phpcs-data', $data);
if ($this->allowed_warnings != -1 && $warnings > $this->allowed_warnings) {
$success = false;
}
if ($this->allowed_errors != -1 && $errors > $this->allowed_errors) {
$success = false;
}
return $success;
}
示例3: execute
/**
* Executes phptal lint
*/
public function execute()
{
$this->phpci->quiet = true;
$this->phpci->logExecOutput(false);
foreach ($this->directories as $dir) {
$this->lintDirectory($dir);
}
$this->phpci->quiet = false;
$this->phpci->logExecOutput(true);
$errors = 0;
$warnings = 0;
foreach ($this->failedPaths as $path) {
if ($path['type'] == 'error') {
$errors++;
} else {
$warnings++;
}
}
$this->build->storeMeta('phptallint-warnings', $warnings);
$this->build->storeMeta('phptallint-errors', $errors);
$this->build->storeMeta('phptallint-data', $this->failedPaths);
$success = true;
if ($this->allowed_warnings != -1 && $warnings > $this->allowed_warnings) {
$success = false;
}
if ($this->allowed_errors != -1 && $errors > $this->allowed_errors) {
$success = false;
}
return $success;
}
示例4: runConfigFile
/**
* Run tests from a Codeception config file.
* @param $configPath
* @return bool|mixed
* @throws \Exception
*/
protected function runConfigFile($configPath)
{
$this->phpci->logExecOutput(false);
$codecept = $this->phpci->findBinary('codecept');
if (!$codecept) {
$this->phpci->logFailure(Lang::get('could_not_find', 'codecept'));
return false;
}
$cmd = 'cd "%s" && ' . $codecept . ' run -c "%s" --xml ' . $this->args;
if (IS_WIN) {
$cmd = 'cd /d "%s" && ' . $codecept . ' run -c "%s" --xml ' . $this->args;
}
$configPath = $this->phpci->buildPath . $configPath;
$success = $this->phpci->executeCommand($cmd, $this->phpci->buildPath, $configPath);
$this->phpci->log('Codeception XML path: ' . $this->phpci->buildPath . $this->path . 'report.xml', Loglevel::DEBUG);
$xml = file_get_contents($this->phpci->buildPath . $this->path . 'report.xml', false);
$parser = new Parser($this->phpci, $xml);
$output = $parser->parse();
$meta = array('tests' => $parser->getTotalTests(), 'timetaken' => $parser->getTotalTimeTaken(), 'failures' => $parser->getTotalFailures());
$this->build->storeMeta('codeception-meta', $meta);
$this->build->storeMeta('codeception-data', $output);
$this->build->storeMeta('codeception-errors', $parser->getTotalFailures());
$this->phpci->logExecOutput(true);
return $success;
}
示例5: executeJsHint
/**
* Execute JSHint.
* @param $binaryPath
*/
protected function executeJsHint($binaryPath)
{
$cmd = $binaryPath . ' %s --reporter checkstyle';
$path = $this->getTargetPath();
// Disable exec output logging, as we don't want the XML report in the log:
$this->phpci->logExecOutput(false);
// Run JSHint:
$this->phpci->executeCommand($cmd, $path);
// Re-enable exec output logging:
$this->phpci->logExecOutput(true);
}
示例6: execute
/**
* Runs the plugin
*/
public function execute()
{
$success = true;
$this->phpci->logExecOutput(false);
$errorCount = $this->getErrorList();
$this->phpci->log("Found {$errorCount} instances of " . implode(', ', $this->searches));
$this->build->storeMeta('technical_debt-warnings', $errorCount);
if ($this->allowed_errors != -1 && $errorCount > $this->allowed_errors) {
$success = false;
}
return $success;
}
示例7: execute
/**
* {@inheritDoc}
*/
public function execute()
{
$success = true;
$this->phpci->logExecOutput(false);
// Run any config files first. This can be either a single value or an array
if ($this->configFile !== null) {
$success &= $this->runConfigFile($this->configFile);
}
$tapString = file_get_contents($this->phpci->buildPath . $this->logPath . DIRECTORY_SEPARATOR . 'report.tap.log');
try {
$tapParser = new TapParser($tapString);
$output = $tapParser->parse();
} catch (\Exception $ex) {
$this->phpci->logFailure($tapString);
throw $ex;
}
$failures = $tapParser->getTotalFailures();
$this->build->storeMeta('codeception-errors', $failures);
$this->build->storeMeta('codeception-data', $output);
$this->phpci->logExecOutput(true);
return $success;
}
示例8: execute
/**
* {@inheritdoc}
*/
public function execute()
{
$curdir = getcwd();
chdir($this->phpci->buildPath);
if (!is_file($this->configFile)) {
$this->phpci->logFailure(sprintf('The Atoum config file "%s" is missing.', $this->configFile));
chdir($curdir);
return false;
}
$this->phpci->logExecOutput(false);
$status = $this->phpci->executeCommand('php %s -c %s -ft -utr', $this->executable, $this->configFile);
$this->phpci->logExecOutput(true);
try {
$parser = new TapParser(mb_convert_encoding('TAP version 13' . PHP_EOL . $this->phpci->getLastOutput(), 'UTF-8', 'ISO-8859-1'));
$data = $parser->parse();
$this->reportErrors($data);
} catch (\Exception $exception) {
$status = false;
$this->phpci->logFailure('Impossible to parse the Atoum output.', $exception);
}
chdir($curdir);
return $status;
}
示例9: executePhpMd
/**
* Execute PHP Mess Detector.
* @param $binaryPath
*/
protected function executePhpMd($binaryPath)
{
$cmd = $binaryPath . ' "%s" xml %s %s %s';
$path = $this->getTargetPath();
$ignore = '';
if (count($this->ignore)) {
$ignore = ' --exclude ' . implode(',', $this->ignore);
}
$suffixes = '';
if (count($this->suffixes)) {
$suffixes = ' --suffixes ' . implode(',', $this->suffixes);
}
// Disable exec output logging, as we don't want the XML report in the log:
$this->phpci->logExecOutput(false);
// Run PHPMD:
$this->phpci->executeCommand($cmd, $path, implode(',', $this->rules), $ignore, $suffixes);
// Re-enable exec output logging:
$this->phpci->logExecOutput(true);
}
示例10: execute
/**
* Runs PHP Mess Detector in a specified directory.
*/
public function execute()
{
// Check that the binary exists:
$checker = $this->phpci->findBinary('phpdoccheck');
if (!$checker) {
$this->phpci->logFailure(PHPCI\Helper\Lang::get('could_not_find', 'phpdoccheck'));
return false;
}
// Build ignore string:
$ignore = '';
if (count($this->ignore)) {
$ignore = ' --exclude="' . implode(',', $this->ignore) . '"';
}
// Are we skipping any checks?
$add = '';
if ($this->skipClasses) {
$add .= ' --skip-classes';
}
if ($this->skipMethods) {
$add .= ' --skip-methods';
}
// Build command string:
$path = $this->phpci->buildPath . $this->path;
$cmd = $checker . ' --json --directory="%s"%s%s';
// Disable exec output logging, as we don't want the XML report in the log:
$this->phpci->logExecOutput(false);
// Run checker:
$this->phpci->executeCommand($cmd, $path, $ignore, $add);
// Re-enable exec output logging:
$this->phpci->logExecOutput(true);
$output = json_decode($this->phpci->getLastOutput(), true);
$errors = count($output);
$success = true;
$this->build->storeMeta('phpdoccheck-warnings', $errors);
$this->build->storeMeta('phpdoccheck-data', $output);
$this->reportErrors($output);
if ($this->allowed_warnings != -1 && $errors > $this->allowed_warnings) {
$success = false;
}
return $success;
}
示例11: getDiffLineNumber
/**
* Uses git diff to figure out what the diff line position is, based on the error line number.
* @param Builder $builder
* @param $file
* @param $line
* @return int|null
*/
protected function getDiffLineNumber(Builder $builder, $file, $line)
{
$builder->logExecOutput(false);
$prNumber = $this->getExtra('pull_request_number');
$path = $builder->buildPath;
if (!empty($prNumber)) {
$builder->executeCommand('cd %s && git diff origin/%s "%s"', $path, $this->getBranch(), $file);
} else {
$builder->executeCommand('cd %s && git diff %s^! "%s"', $path, $this->getCommitId(), $file);
}
$builder->logExecOutput(true);
$diff = $builder->getLastOutput();
$helper = new Diff();
$lines = $helper->getLinePositions($diff);
return $lines[$line];
}
示例12: getDiffLineNumber
/**
* Uses git diff to figure out what the diff line position is, based on the error line number.
* @param Builder $builder
* @param $file
* @param $line
* @return int|null
*/
protected function getDiffLineNumber(Builder $builder, $file, $line)
{
$line = (int) $line;
$builder->logExecOutput(false);
$prNumber = $this->getExtra('pull_request_number');
$path = $builder->buildPath;
if (!empty($prNumber)) {
$builder->executeCommand('cd %s && git diff origin/%s "%s"', $path, $this->getBranch(), $file);
} else {
$commitId = $this->getCommitId();
$compare = $commitId == 'Manual' ? 'HEAD' : $commitId;
$builder->executeCommand('cd %s && git diff %s^^ "%s"', $path, $compare, $file);
}
$builder->logExecOutput(true);
$diff = $builder->getLastOutput();
$helper = new Diff();
$lines = $helper->getLinePositions($diff);
return isset($lines[$line]) ? $lines[$line] : null;
}