本文整理汇总了PHP中Test::clear方法的典型用法代码示例。如果您正苦于以下问题:PHP Test::clear方法的具体用法?PHP Test::clear怎么用?PHP Test::clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Test
的用法示例。
在下文中一共展示了Test::clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test
/**
* 単体テストを実行する
* @param string $class
* @param string $method
* @param string $block_name
*/
function test($class, $method = null, $block_name = null)
{
Test::verify($class, $method, $block_name);
print new Test();
Test::clear();
}
示例2: __str__
protected function __str__()
{
$result = "";
$tab = " ";
$success = $fail = $none = 0;
$cli = isset($_SERVER['argc']) && !empty($_SERVER['argc']) && substr(PHP_OS, 0, 3) != 'WIN';
foreach (self::$result as $file => $f) {
foreach ($f as $class => $c) {
$result .= (empty($class) ? "*****" : $class) . " [ " . $file . " ]\n";
$result .= str_repeat("-", 80) . "\n";
foreach ($c as $method => $m) {
foreach ($m as $line => $r) {
foreach ($r as $l) {
switch (sizeof($l)) {
case 0:
$success++;
if (substr(self::$exec_type, -2, 1) != "1") {
break;
}
$result .= "[" . $line . "]" . $method . ": " . self::fcolor("success", "32") . "\n";
break;
case 1:
$none++;
if (substr(self::$exec_type, -3, 1) != "1") {
break;
}
$result .= "[" . $line . "]" . $method . ": " . self::fcolor("none", "1;35") . "\n";
break;
case 2:
$fail++;
if (substr(self::$exec_type, -4, 1) != "1") {
break;
}
$result .= "[" . $line . "]" . $method . ": " . self::fcolor("fail", "1;31") . "\n";
$result .= $tab . str_repeat("=", 70) . "\n";
ob_start();
var_dump($l[0]);
$result .= self::fcolor($tab . str_replace("\n", "\n" . $tab, ob_get_contents()), "33");
ob_end_clean();
$result .= "\n" . $tab . str_repeat("=", 70) . "\n";
ob_start();
var_dump($l[1]);
$result .= self::fcolor($tab . str_replace("\n", "\n" . $tab, ob_get_contents()), "31");
ob_end_clean();
$result .= "\n" . $tab . str_repeat("=", 70) . "\n";
break;
case 4:
$fail++;
if (substr(self::$exec_type, -4, 1) != "1") {
break;
}
$result .= "[" . $line . "]" . $method . ": " . self::fcolor("exception", "1;31") . "\n";
$result .= $tab . str_repeat("=", 70) . "\n";
$result .= self::fcolor($tab . $l[1] . "\n\n" . $tab . $l[2] . ":" . $l[3], "31");
$result .= "\n" . $tab . str_repeat("=", 70) . "\n";
break;
}
}
}
}
}
$result .= "\n";
}
Test::clear();
if (substr(self::$exec_type, -5, 1) == "1") {
$result .= self::fcolor(" success: " . $success . " ", "7;32") . " " . self::fcolor(" fail: " . $fail . " ", "7;31") . " " . self::fcolor(" none: " . $none . " ", "7;35") . "\n";
}
return $result;
}