当前位置: 首页>>代码示例>>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;未经允许,请勿转载。