本文整理汇总了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>';
}