Пример #1
0
 /**
  * Checks if the test is still running.
  * @return bool
  */
 public function isRunning()
 {
     if (!is_resource($this->stdout)) {
         return FALSE;
     }
     $this->output .= stream_get_contents($this->stdout);
     if ($this->stderr) {
         $this->errorOutput .= stream_get_contents($this->stderr);
     }
     $status = proc_get_status($this->proc);
     if ($status['running']) {
         return TRUE;
     }
     fclose($this->stdout);
     if ($this->stderr) {
         fclose($this->stderr);
     }
     $code = proc_close($this->proc);
     $this->exitCode = $code === self::CODE_NONE ? $status['exitcode'] : $code;
     if ($this->interpreter->isCgi() && count($tmp = explode("\r\n\r\n", $this->output, 2)) >= 2) {
         list($headers, $this->output) = $tmp;
         foreach (explode("\r\n", $headers) as $header) {
             $a = strpos($header, ':');
             if ($a !== FALSE) {
                 $this->headers[trim(substr($header, 0, $a))] = (string) trim(substr($header, $a + 1));
             }
         }
     }
     return FALSE;
 }
Пример #2
0
 /** @return string */
 private function prepareCodeCoverage()
 {
     if (!$this->interpreter->canMeasureCodeCoverage()) {
         $alternative = PHP_VERSION_ID >= 70000 ? ' or phpdbg SAPI' : '';
         throw new \Exception("Code coverage functionality requires Xdebug extension{$alternative} (used {$this->interpreter->getCommandLine()})");
     }
     file_put_contents($this->options['--coverage'], '');
     $file = realpath($this->options['--coverage']);
     echo "Code coverage: {$file}\n";
     return $file;
 }
Пример #3
0
 /** @return string */
 private function prepareCodeCoverage()
 {
     if (!$this->interpreter->hasXdebug()) {
         throw new \Exception("Code coverage functionality requires Xdebug extension (used {$this->interpreter->getCommandLine()})");
     }
     file_put_contents($this->options['--coverage'], '');
     $file = realpath($this->options['--coverage']);
     putenv(Environment::COVERAGE . '=' . $file);
     echo "Code coverage: {$file}\n";
     if (preg_match('#\\.html?\\z#', $file)) {
         return $file;
     }
 }
Пример #4
0
 /** @return string */
 private function prepareCodeCoverage()
 {
     if (!$this->interpreter->hasXdebug()) {
         $alternative = PHP_VERSION_ID >= 70000 ? ' or phpdbg SAPI' : '';
         throw new \Exception("Code coverage functionality requires Xdebug extension{$alternative} (used {$this->interpreter->getCommandLine()})");
     }
     file_put_contents($this->options['--coverage'], '');
     $file = realpath($this->options['--coverage']);
     putenv(Environment::COVERAGE . '=' . $file);
     echo "Code coverage: {$file}\n";
     if (preg_match('#\\.(?:html?|xml)\\z#', $file)) {
         return $file;
     }
 }
Пример #5
0
 private function initiatePhpVersion($version, PhpInterpreter $interpreter)
 {
     if (preg_match('#^(<=|<|==|=|!=|<>|>=|>)?\\s*(.+)#', $version, $matches) && version_compare($matches[2], $interpreter->getVersion(), $matches[1] ?: '>=')) {
         return array(Runner::SKIPPED, "Requires PHP {$version}.");
     }
 }