当前位置: 首页>>代码示例>>PHP>>正文


PHP BaseTest::_indent方法代码示例

本文整理汇总了PHP中BaseTest::_indent方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseTest::_indent方法的具体用法?PHP BaseTest::_indent怎么用?PHP BaseTest::_indent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BaseTest的用法示例。


在下文中一共展示了BaseTest::_indent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public static function run()
 {
     self::loadClasses();
     $total = 0;
     $failed = 0;
     $errors = 0;
     echo BaseTest::_indent('Starting testing phase:');
     $cwd = getcwd();
     foreach (self::$children as $instance) {
         chdir(static::classFolder($instance));
         $instance->prepare();
         $methods = get_class_methods($instance);
         foreach ($methods as $method) {
             if (!preg_match('/^test[a-zA-Z0-9_]*$/', $method)) {
                 continue;
             }
             static::$state = BaseTest::STATE_OK;
             static::$tests = 0;
             echo BaseTest::_indent('Running test "' . get_class($instance) . '->' . $method . '"<br />', 1);
             try {
                 $msg = call_user_method($method, $instance);
                 if (is_string($msg)) {
                     echo BaseTest::_indent('<span class="message">Got Message ' . $msg . ' </span><br />', 2);
                 }
                 if (static::$state == BaseTest::STATE_OK) {
                     echo BaseTest::_indent('<span class="ok">Sub tests passed (' . static::$tests . ' tests ran)</span><br />', 1);
                 } else {
                     $failed += static::$tests;
                     echo BaseTest::_indent('<span class="warning">Sub tests not passed. (' . static::$tests . ' tests ran)</span><br />', 1);
                 }
                 $total += static::$tests;
             } catch (Exception $e) {
                 static::$tests++;
                 // Was not increased due to error
                 $total += static::$tests;
                 $errors += static::$tests;
                 echo BaseTest::_indent('<span class="error">Error while testing. Msg:' . $e->getMessage() . ' (' . static::$tests . ' tests ran)</span><br />', 1);
                 continue;
             }
             echo '<br />';
         }
         $instance->finish();
     }
     chdir($cwd);
     echo '<div class="results">';
     echo 'Testing finished, a total of <strong>' . $total . '</strong> tests ran: <br />';
     echo BaseTest::_indent('<span class="label label-result">Errors:</span><span class="error">' . $errors . '</span><br />', 1);
     echo BaseTest::_indent('<span class="label label-result">Fails:</span><span class="warning">' . $failed . '</span><br />', 1);
     echo BaseTest::_indent('<span class="label label-result">Passed:</span><span class="ok">' . ($total - $errors - $failed) . '</span><br />', 1);
     echo '</div>';
 }
开发者ID:Makae,项目名称:ch.bfh.bti7054.w2014.q.groot,代码行数:51,代码来源:class.basetest.php


注:本文中的BaseTest::_indent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。