getOutput() public method

Returns test output.
public getOutput ( ) : string
return string
Esempio n. 1
1
 private function assessOutputMatch(Job $job, $content)
 {
     if (!Tester\Assert::isMatching($content, $job->getOutput())) {
         Dumper::saveOutput($job->getFile(), $job->getOutput(), '.actual');
         Dumper::saveOutput($job->getFile(), $content, '.expected');
         return array(Runner::FAILED, 'Failed: output should match ' . Dumper::toLine(rtrim($content)));
     }
 }
Esempio n. 2
0
 /** @return int|NULL */
 public function run()
 {
     Environment::setupColors();
     Environment::setupErrors();
     ob_start();
     $cmd = $this->loadOptions();
     Environment::$debugMode = (bool) $this->options['--debug'];
     if (isset($this->options['--colors'])) {
         Environment::$useColors = (bool) $this->options['--colors'];
     } elseif (in_array($this->options['-o'], ['tap', 'junit'])) {
         Environment::$useColors = FALSE;
     }
     if ($cmd->isEmpty() || $this->options['--help']) {
         $cmd->help();
         return;
     }
     $this->createPhpInterpreter();
     if ($this->options['--info']) {
         $job = new Job(__DIR__ . '/info.php', $this->interpreter);
         $job->run();
         echo $job->getOutput();
         return;
     }
     if ($this->options['--coverage']) {
         $coverageFile = $this->prepareCodeCoverage();
     }
     $runner = $this->createRunner();
     $runner->setEnvironmentVariable(Environment::RUNNER, 1);
     $runner->setEnvironmentVariable(Environment::COLORS, (int) Environment::$useColors);
     if (isset($coverageFile)) {
         $runner->setEnvironmentVariable(Environment::COVERAGE, $coverageFile);
     }
     if ($this->options['-o'] !== NULL) {
         ob_clean();
     }
     ob_end_flush();
     if ($this->options['--watch']) {
         $this->watch($runner);
         return;
     }
     $result = $runner->run();
     if (isset($coverageFile) && preg_match('#\\.(?:html?|xml)\\z#', $coverageFile)) {
         $this->finishCodeCoverage($coverageFile);
     }
     return $result ? 0 : 1;
 }
Esempio n. 3
0
 /** @return int|NULL */
 public function run()
 {
     Environment::setupColors();
     Environment::setupErrors();
     ob_start();
     $cmd = $this->loadOptions();
     Environment::$debugMode = (bool) $this->options['--debug'];
     if (isset($this->options['--colors'])) {
         Environment::$useColors = (bool) $this->options['--colors'];
     } elseif ($this->options['-o'] === 'tap') {
         Environment::$useColors = FALSE;
     }
     if ($cmd->isEmpty() || $this->options['--help']) {
         $cmd->help();
         return;
     }
     $this->createPhpInterpreter();
     if ($this->options['--info']) {
         $job = new Job(__DIR__ . '/info.php', $this->interpreter);
         $job->run();
         echo $job->getOutput();
         return;
     }
     if ($this->options['--coverage']) {
         $coverageFile = $this->prepareCodeCoverage();
     }
     $runner = $this->createRunner();
     if ($this->options['-o'] !== NULL) {
         ob_clean();
     }
     ob_end_flush();
     if ($this->options['--watch']) {
         $this->watch($runner);
         return;
     }
     $result = $runner->run();
     if (isset($coverageFile)) {
         $this->finishCodeCoverage($coverageFile);
     }
     return $result ? 0 : 1;
 }