當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Test::clear方法代碼示例

本文整理匯總了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();
 }
開發者ID:hisaboh,項目名稱:w2t,代碼行數:12,代碼來源:Test.php

示例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;
 }
開發者ID:satully,項目名稱:dev_socialapp,代碼行數:69,代碼來源:Test.php


注:本文中的Test::clear方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。