writeResult() public method

Writes to output handlers.
public writeResult ( $testName, $result, $message = NULL ) : void
return void
Example #1
0
 /**
  * @return void
  */
 public function assess(Job $job)
 {
     list($annotations, $testName) = $this->getAnnotations($job->getFile());
     $testName .= strlen($job->getArguments()) ? " [{$job->getArguments()}]" : '';
     $annotations += array('exitcode' => Job::CODE_OK, 'httpcode' => self::HTTP_OK);
     foreach (get_class_methods($this) as $method) {
         if (!preg_match('#^assess(.+)#', strtolower($method), $m) || !isset($annotations[$m[1]])) {
             continue;
         }
         foreach ((array) $annotations[$m[1]] as $arg) {
             if ($res = $this->{$method}($job, $arg)) {
                 $this->runner->writeResult($testName, $res[0], $res[1]);
                 return;
             }
         }
     }
     $this->runner->writeResult($testName, Runner::PASSED);
 }
Example #2
0
 /**
  * @return void
  */
 public function assess(Job $job)
 {
     list($annotations, $testName) = $this->getAnnotations($job->getFile());
     $testName .= $job->getArguments() ? ' [' . implode(' ', preg_replace(array('#["\'-]*(.+?)["\']?$#A', '#(.{30}).+#A'), array('$1', '$1...'), $job->getArguments())) . ']' : '';
     $annotations += array('exitcode' => Job::CODE_OK, 'httpcode' => self::HTTP_OK);
     foreach (get_class_methods($this) as $method) {
         if (!preg_match('#^assess(.+)#', strtolower($method), $m) || !isset($annotations[$m[1]])) {
             continue;
         }
         foreach ((array) $annotations[$m[1]] as $arg) {
             if ($res = $this->{$method}($job, $arg)) {
                 $this->runner->writeResult($testName, $res[0], $res[1]);
                 return;
             }
         }
     }
     $this->runner->writeResult($testName, Runner::PASSED);
 }