/** * @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); }
/** * @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); }