Exemplo n.º 1
0
 /**
  * runs a specific test in a file
  *
  * @param TestCase $test
  * @param string $method
  * @return void
  */
 protected function _runMethod(TestCase $test, $method)
 {
     // if the method is not a test method then we should ignore it
     if (preg_match('/test[A-Z0-9_]{1}/', $method) == 0) {
         return;
     }
     $this->current(array($test, $method));
     $tracker = Tracker::getInstance();
     $tracker->incrementTestCount();
     try {
         $test->{$method}();
     } catch (\Exception $e) {
         $test->caughtException($e);
     }
     $test->hasFinished();
     // log the test result to command line
     if ($test->hadFailure($method)) {
         return $tracker->output('F', 'red');
     }
     if ($test->hadError($method)) {
         return $tracker->output('E', 'yellow');
     }
     return $tracker->output('.', 'green');
 }