private static final function execute(InfoMethod $m, $block_name, $class, $is_setup, $is_teardown) { if (!$m->is_test() && $m->is_public()) { return self::$result[self::$current_file][self::$current_class][self::$current_method][$m->line()][] = array("none"); } $result = $line = ""; try { foreach ($m->test() as $line => $test) { if ($block_name === null || $test->name() === $block_name) { ob_start(); $exception = null; if ($is_setup) { call_user_func(array($class, "__test_setup__")); } try { eval(str_repeat("\n", $line) . $test->test()); } catch (Exception $e) { $exception = $e; } if ($is_teardown) { call_user_func(array($class, "__test_teardown__")); } if (isset($exception)) { throw $exception; } $result = ob_get_clean(); if (preg_match("/(Parse|Fatal) error:.+/", $result, $match)) { throw new ErrorException($match[0]); } } Exceptions::clear(); } print $result; } catch (Exception $e) { if (ob_get_level() > 0) { $result = ob_get_clean(); } if (preg_match("/^[\\s]+/ms", $test->test(), $match)) { $line = $line + substr_count($match[0], "\n"); } self::$result[self::$current_file][self::$current_class][self::$current_method][$line][] = array("exception", $e->getMessage(), $e->getFile(), $e->getLine()); Log::warn("[" . $e->getFile() . ":" . $e->getLine() . "] " . $e->getMessage()); } }