function run() { foreach ($this->_testCases as $target) { $pos = strrpos(basename($target), '.'); $class = ucfirst(substr(basename($target), 0, $pos)) . 'Test'; require_once $target; $start = date('Y-m-d G-i-s'); $TestCase = new $class(); $TestCase->init(); $result = $TestCase->run(); $end = date('Y-m-d G-i-s'); $name = get_class($TestCase); $count = 0; $error_count = 0; $msg = ""; foreach ($result as $k => $r) { $count++; if (XUtil::arrayGetOr($r, 'status', 'NG') != "OK") { $error_count++; $msg = $k . ":" . XUtil::arrayGetOr($r, 'status', 'NG') . "\n" . implode("\n", XUtil::arrayGetOr($r, 'errors', array())); } } echo "\n"; echo "Start->{$name} start={$start}\n"; echo "{$name} test={$count} errors={$error_count}\n"; echo !empty($msg) ? "{$msg}\n" : ""; echo "End->{$name} end={$end}\n"; } }
function __construct($name, $conf, $level) { parent::__construct(); $this->_append = isset($conf['append']) && $conf['append'] == 1 ? true : false; $this->_dirname = XUtil::arrayGetOr($conf, 'dirname', $this->_dirname); $this->_filename = XUtil::arrayGetOr($conf, 'filename', $this->_filename); $this->_name = $name; $this->_eol = strstr(PHP_OS, 'WIN') ? "\r\n" : "\n"; $this->_mask = $this->MAX($level); // if script is down close fp register_shutdown_function(array($this, 'close')); }
private function _getTagInfo($text) { $tagInfo = explode(" ", $text, 2); $tagName = $tagInfo[0]; $tagArg = XUtil::arrayGetOr($tagInfo, 1, ""); return array($tagName, $tagArg); }