本文整理汇总了PHP中PHPUnit::toHTML方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit::toHTML方法的具体用法?PHP PHPUnit::toHTML怎么用?PHP PHPUnit::toHTML使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit
的用法示例。
在下文中一共展示了PHPUnit::toHTML方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
function main() {
// include_once($_SERVER['DOCUMENT_ROOT'].'/ScarletFinal/classes/Template.php');
// $template = new Template('main.tpl/');
include('header.php');
// $template->compile('main.tpl');
require_once '../Sandbox.php';
include '../PHPUnit.php';
if(isset($_GET['path']) && is_dir($_GET['path'])) {
$suite = (isset($_GET['test'])) ? $_GET['test'] : '';
$phpunit = new PHPUnit($_GET['path'], $suite);
chdir($_GET['path']);
} else {
throw new Exception("Could not find the specified tests directory: <strong>".$_GET['path'].'</strong>', 1);
}
$results = $phpunit->run();
// print_r($results);
echo $phpunit->toHTML($results);
include('footer.php');
// include('main.php');
}
示例2: check_for_errors
function check_for_errors() {
function toHTML($type, $e) {
$left = '<div class="box rounded error">';
$out = '<div class="light rounded">!</div>
<div class="message">'.$type.': '.$e['message'].'</div>
<div class="line">'.$e['line'].'</div>
<div class="file">'.$e['file'].'</div>';
$right = '</div>';
return $left.$out.$right;
}
$results_so_far = '';
if(stristr(@ob_get_contents(),"<body>")) { //this is already HTML
//do nothing for now. In the future we may change behaviour
} elseif (@ob_get_contents()) { //this is json output, process it.
$results_so_far = @ob_get_contents();
@ob_clean();
echo PHPUnit::toHTML($results_so_far);
}
if( false === is_null($aError = error_get_last()) ) {
switch($aError['type']) {
case E_NOTICE:
echo toHTML("Notice", $aError);
break;
case E_WARNING:
echo toHTML("Warning", $aError);
break;
case E_ERROR:
echo toHTML("Error", $aError);
break;
case E_PARSE:
echo toHTML("Parse", $aError);
break;
default:
echo toHTML("Unknown", $aError);
echo "<br/>";
break;
}
}
if($results_so_far) {
include('Main/footer.php');
}
exit(1);
}
示例3: check_for_errors
function check_for_errors()
{
function toHTML($type, $e)
{
$left = '<div class="box rounded error">';
$out = '<div class="light rounded">!</div>
<div class="message">' . $type . ': ' . $e['message'] . '</div>
<div class="line">' . $e['line'] . '</div>
<div class="file">' . $e['file'] . '</div>';
$right = '</div>';
return $left . $out . $right;
}
$results_so_far = '';
if (@ob_get_contents()) {
$results_so_far = @ob_get_contents();
@ob_clean();
echo PHPUnit::toHTML($results_so_far);
}
if (false === is_null($aError = error_get_last())) {
switch ($aError['type']) {
case E_NOTICE:
echo toHTML("Notice", $aError);
break;
case E_WARNING:
echo toHTML("Warning", $aError);
break;
case E_ERROR:
echo toHTML("Error", $aError);
break;
case E_PARSE:
echo toHTML("Parse", $aError);
break;
default:
echo toHTML("Unknown", $aError);
echo "<br/>";
break;
}
}
if ($results_so_far) {
include 'Main/footer.php';
}
exit(1);
}