当前位置: 首页>>代码示例>>PHP>>正文


PHP Builder::logFailure方法代码示例

本文整理汇总了PHP中PHPCI\Builder::logFailure方法的典型用法代码示例。如果您正苦于以下问题:PHP Builder::logFailure方法的具体用法?PHP Builder::logFailure怎么用?PHP Builder::logFailure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPCI\Builder的用法示例。


在下文中一共展示了Builder::logFailure方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * Runs Pdepend with the given criteria as arguments
  */
 public function execute()
 {
     if (!is_writable($this->location)) {
         throw new \Exception(sprintf('The location %s is not writable.', $this->location));
     }
     $pdepend = $this->phpci->findBinary('pdepend');
     if (!$pdepend) {
         $this->phpci->logFailure(Lang::get('could_not_find', 'pdepend'));
         return false;
     }
     $cmd = $pdepend . ' --summary-xml="%s" --jdepend-chart="%s" --overview-pyramid="%s" %s "%s"';
     $this->removeBuildArtifacts();
     // If we need to ignore directories
     if (count($this->phpci->ignore)) {
         $ignore = ' --ignore=' . implode(',', $this->phpci->ignore);
     } else {
         $ignore = '';
     }
     $success = $this->phpci->executeCommand($cmd, $this->location . DIRECTORY_SEPARATOR . $this->summary, $this->location . DIRECTORY_SEPARATOR . $this->chart, $this->location . DIRECTORY_SEPARATOR . $this->pyramid, $ignore, $this->directory);
     $config = $this->phpci->getSystemConfig('phpci');
     if ($success) {
         $this->phpci->logSuccess(sprintf("Pdepend successful. You can use %s\n, ![Chart](%s \"Pdepend Chart\")\n\n                    and ![Pyramid](%s \"Pdepend Pyramid\")\n\n                    for inclusion in the readme.md file", $config['url'] . '/build/pdepend/' . $this->summary, $config['url'] . '/build/pdepend/' . $this->chart, $config['url'] . '/build/pdepend/' . $this->pyramid));
     }
     return $success;
 }
开发者ID:mrudtf,项目名称:PHPCI,代码行数:28,代码来源:Pdepend.php

示例2: execute

 /**
  * Runs PHP Copy/Paste Detector in a specified directory.
  */
 public function execute()
 {
     $ignore = '';
     if (count($this->phpci->ignore)) {
         $map = function ($item) {
             return ' --exclude ' . (substr($item, -1) == '/' ? substr($item, 0, -1) : $item);
         };
         $ignore = array_map($map, $this->phpci->ignore);
         $ignore = implode('', $ignore);
     }
     $phploc = $this->phpci->findBinary('phploc');
     if (!$phploc) {
         $this->phpci->logFailure(PHPCI\Helper\Lang::get('could_not_find', 'phploc'));
         return false;
     }
     $success = $this->phpci->executeCommand($phploc . ' %s "%s"', $ignore, $this->directory);
     $output = $this->phpci->getLastOutput();
     if (preg_match_all('/\\((LOC|CLOC|NCLOC|LLOC)\\)\\s+([0-9]+)/', $output, $matches)) {
         $data = array();
         foreach ($matches[1] as $k => $v) {
             $data[$v] = (int) $matches[2][$k];
         }
         $this->build->storeMeta('phploc', $data);
     }
     return $success;
 }
开发者ID:mrudtf,项目名称:PHPCI,代码行数:29,代码来源:PhpLoc.php

示例3: execute

 /**
  * Runs PHP Spec tests.
  */
 public function execute()
 {
     $curdir = getcwd();
     chdir($this->phpci->buildPath);
     $phpspec = $this->phpci->findBinary(array('phpspec', 'phpspec.php'));
     if (!$phpspec) {
         $this->phpci->logFailure(PHPCI\Helper\Lang::get('could_not_find', 'phpspec'));
         return false;
     }
     $success = $this->phpci->executeCommand($phpspec . ' --format=junit --no-code-generation run');
     $output = $this->phpci->getLastOutput();
     chdir($curdir);
     /*
      * process xml output
      *
      * <testsuites time=FLOAT tests=INT failures=INT errors=INT>
      *   <testsuite name=STRING time=FLOAT tests=INT failures=INT errors=INT skipped=INT>
      *     <testcase name=STRING time=FLOAT classname=STRING status=STRING/>
      *   </testsuite>
      * </testsuites
      */
     $xml = new \SimpleXMLElement($output);
     $attr = $xml->attributes();
     $data = array('time' => (double) $attr['time'], 'tests' => (int) $attr['tests'], 'failures' => (int) $attr['failures'], 'errors' => (int) $attr['errors'], 'suites' => array());
     /**
      * @var \SimpleXMLElement $group
      */
     foreach ($xml->xpath('testsuite') as $group) {
         $attr = $group->attributes();
         $suite = array('name' => (string) $attr['name'], 'time' => (double) $attr['time'], 'tests' => (int) $attr['tests'], 'failures' => (int) $attr['failures'], 'errors' => (int) $attr['errors'], 'skipped' => (int) $attr['skipped'], 'cases' => array());
         /**
          * @var \SimpleXMLElement $child
          */
         foreach ($group->xpath('testcase') as $child) {
             $attr = $child->attributes();
             $case = array('name' => (string) $attr['name'], 'classname' => (string) $attr['classname'], 'time' => (double) $attr['time'], 'status' => (string) $attr['status']);
             if ($case['status'] == 'failed') {
                 $error = array();
                 /*
                  * ok, sad, we had an error
                  *
                  * there should be one - foreach makes this easier
                  */
                 foreach ($child->xpath('failure') as $failure) {
                     $attr = $failure->attributes();
                     $error['type'] = (string) $attr['type'];
                     $error['message'] = (string) $attr['message'];
                 }
                 foreach ($child->xpath('system-err') as $system_err) {
                     $error['raw'] = (string) $system_err;
                 }
                 $case['error'] = $error;
             }
             $suite['cases'][] = $case;
         }
         $data['suites'][] = $suite;
     }
     $this->build->storeMeta('phpspec', $data);
     return $success;
 }
开发者ID:mrudtf,项目名称:PHPCI,代码行数:63,代码来源:PhpSpec.php

示例4: 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;
 }
开发者ID:jtiret,项目名称:phpci-casperjs,代码行数:31,代码来源:CasperJs.php

示例5: execute

 /**
  * Runs PHP Spec tests.
  */
 public function execute()
 {
     $curdir = getcwd();
     chdir($this->phpci->buildPath);
     $phpspec = $this->phpci->findBinary(array('phpspec', 'phpspec.php'));
     if (!$phpspec) {
         $this->phpci->logFailure('Could not find phpspec.');
         return false;
     }
     $success = $this->phpci->executeCommand($phpspec . ' --format=pretty --no-code-generation run');
     chdir($curdir);
     return $success;
 }
开发者ID:kukupigs,项目名称:PHPCI,代码行数:16,代码来源:PhpSpec.php

示例6: execute

 /**
  * Connects to SQLite and runs a specified set of queries.
  * @return boolean
  */
 public function execute()
 {
     try {
         $opts = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);
         $pdo = new PDO('sqlite:' . $this->path, $opts);
         foreach ($this->queries as $query) {
             $pdo->query($query);
         }
     } catch (\Exception $ex) {
         $this->phpci->logFailure($ex->getMessage());
         return false;
     }
     return true;
 }
开发者ID:mrudtf,项目名称:PHPCI,代码行数:18,代码来源:Sqlite.php

示例7: execute

 /**
  * Connects to PgSQL and runs a specified set of queries.
  * @return boolean
  */
 public function execute()
 {
     try {
         $opts = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);
         $pdo = new PDO('pgsql:host=' . $this->host, $this->user, $this->pass, $opts);
         foreach ($this->queries as $query) {
             $pdo->query($this->phpci->interpolate($query));
         }
     } catch (\Exception $ex) {
         $this->phpci->logFailure($ex->getMessage());
         return false;
     }
     return true;
 }
开发者ID:nelsonyang0710,项目名称:PHPCI,代码行数:18,代码来源:Pgsql.php

示例8: execute

 public function execute()
 {
     $curdir = getcwd();
     chdir($this->workingdir);
     $phpcsfixer = $this->phpci->findBinary('php-cs-fixer');
     if (!$phpcsfixer) {
         $this->phpci->logFailure('Could not find php-cs-fixer.');
         return false;
     }
     $cmd = $phpcsfixer . ' fix . %s %s %s';
     $success = $this->phpci->executeCommand($cmd, $this->verbose, $this->diff, $this->level);
     chdir($curdir);
     return $success;
 }
开发者ID:kukupigs,项目名称:PHPCI,代码行数:14,代码来源:PhpCsFixer.php

示例9: execute

 /**
  * Triggers Jenkins Build for the project
  */
 public function execute()
 {
     $success = true;
     if ($this->build->isSuccessful()) {
         // Builds the Jenkins trigger
         $jenkins = $this->jenkinsUrl . '/job/' . rawurlencode($this->jenkinsProject) . '/build?delay=0sec';
         if ($this->jenkinsToken && !empty($this->jenkinsToken)) {
             $jenkins .= '&token=%s';
         }
         $jenkins = sprintf($jenkins, rawurlencode($this->jenkinsProject), $this->jenkinsToken);
         $this->phpci->log($jenkins);
         $curlHandler = curl_init($jenkins);
         curl_setopt($curlHandler, CURLOPT_RETURNTRANSFER, 1);
         curl_exec($curlHandler);
         $status = curl_getinfo($curlHandler, CURLINFO_HTTP_CODE);
         $curlUrl = curl_getinfo($curlHandler, CURLINFO_EFFECTIVE_URL);
         curl_close($curlHandler);
         if ($status != '200') {
             $this->phpci->logFailure($curlUrl . ' return with status code ' . $status);
             return false;
         }
     } else {
         $this->phpci->log('Skipping due to failed Build');
     }
     return $success;
 }
开发者ID:kdemanuele,项目名称:PHPCI-Jenkins-Plugin,代码行数:29,代码来源:Jenkins.php

示例10: 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;
 }
开发者ID:kukupigs,项目名称:PHPCI,代码行数:29,代码来源:PhpCodeSniffer.php

示例11: 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;
 }
开发者ID:ntoniazzi,项目名称:PHPCI,代码行数:31,代码来源:Codeception.php

示例12: execute

 /**
  * Connects to PgSQL and runs a specified set of queries.
  * @return boolean
  */
 public function execute()
 {
     try {
         $opts = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);
         $pdo = new PDO('pgsql:host=' . $this->host, $this->user, $this->pass, $opts);
         foreach ($this->queries as $query) {
             if (!is_array($query)) {
                 // Simple query
                 $pdo->query($this->phpci->interpolate($query));
             } elseif (isset($query['queries'])) {
                 foreach ($query['queries'] as $query_stm) {
                     // Simple query
                     $pdo->query($this->phpci->interpolate($query_stm));
                 }
             } elseif (isset($query['import'])) {
                 // SQL file execution
                 $this->executeFile($query['import']);
             } else {
                 throw new \Exception(Lang::get('invalid_command'));
             }
         }
     } catch (\Exception $ex) {
         $this->phpci->logFailure($ex->getMessage());
         return false;
     }
     return true;
 }
开发者ID:seshurajup,项目名称:PHPCI,代码行数:31,代码来源:Pgsql.php

示例13: execute

 /**
  * Executes parallel lint
  */
 public function execute()
 {
     list($ignore) = $this->getFlags();
     $phplint = $this->phpci->findBinary('parallel-lint');
     if (!$phplint) {
         $this->phpci->logFailure(Lang::get('could_not_find', 'parallel-lint'));
         return false;
     }
     $cmd = $phplint . ' %s "%s"';
     $success = $this->phpci->executeCommand($cmd, $ignore, $this->directory);
     $output = $this->phpci->getLastOutput();
     $matches = array();
     if (preg_match_all('/Parse error\\:/', $output, $matches)) {
         $this->build->storeMeta('phplint-errors', count($matches[0]));
     }
     return $success;
 }
开发者ID:mrudtf,项目名称:PHPCI,代码行数:20,代码来源:PhpParallelLint.php

示例14: runConfigFile

 protected function runConfigFile($configPath)
 {
     if (is_array($configPath)) {
         return $this->recurseArg($configPath, array($this, "runConfigFile"));
     } else {
         $codecept = $this->phpci->findBinary('codecept');
         if (!$codecept) {
             $this->phpci->logFailure('Could not find codeception.');
             return false;
         }
         $cmd = 'cd "%s" && ' . $codecept . ' run -c "%s" ' . $this->args;
         if (IS_WIN) {
             $cmd = 'cd /d "%s" && ' . $codecept . ' run -c "%s" ' . $this->args;
         }
         $configPath = $this->phpci->buildPath . $configPath;
         $success = $this->phpci->executeCommand($cmd, $this->phpci->buildPath, $configPath);
         return $success;
     }
 }
开发者ID:kukupigs,项目名称:PHPCI,代码行数:19,代码来源:Codeception.php

示例15: execute

 /**
  * Runs the copy command.
  *
  * @return bool
  */
 public function execute()
 {
     $destinationFilename = $this->phpci->buildPath . '/' . $this->envFilename;
     $this->phpci->log(sprintf('Copy external environment file %s for the %s branch to build directory', $this->envFilepath, $this->branch));
     if (!copy($this->envFilepath, $destinationFilename)) {
         $this->phpci->logFailure('Copy error environment file to build directory!');
         return false;
     }
     $this->phpci->logSuccess('External environment file successful copied.');
     return true;
 }
开发者ID:rephlux,项目名称:phpci-external-env,代码行数:16,代码来源:ExternalEnvironment.php


注:本文中的PHPCI\Builder::logFailure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。