/** * emulate disabled intl extension * * enable it only for tests prefixed with testIntl * @param Testcase $test */ public static function setIntlStatus($test) { static::$enableIntl = null; if (strncmp($test->getName(false), 'testIntl', 8) === 0) { if (!extension_loaded('intl')) { $test->markTestSkipped('intl extension is not installed.'); } static::$enableIntl = true; } else { static::$enableIntl = false; } }
<?php $testcaseAPI = new Testcase(); ?> <div class="panel panel-transparent"> <div class="panel-body no-padding"> <div class="table-responsive"> <table class="table table-hover table-condensed" id=""> <thead> <tr> <th style="width:30%">Testcase</th> <th style="width:50%">Type</th> <th style="width:20%"><i class="fa fa-gear"></i></th> </tr> </thead> <tbody> <?php foreach ($testcaseAPI->get($assignment_id, false) as $testcase) { ?> <tr data-testcase-id="<?php echo $testcase['testcase_id']; ?> "> <td class="v-align-middle semi-bold"><?php echo $testcase['testcase_id']; ?> </td> <td class="v-align-middle"><?php echo $testcase['type']; ?>
<?php header("Content-type: text/html; charset=utf-8"); header("Cache-Control: no-cache, max-age=10, must-revalidate"); error_reporting(E_ERROR | E_WARNING); if (!array_key_exists('quirk', $_GET)) { print '<!DOCTYPE html>'; } require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "../lib/php/case.class.php"; require dirname(__FILE__) . DIRECTORY_SEPARATOR . "../lib/php/filehelper.php"; $c = new Testcase($_GET['case']); $title = $c->name; $cov = false; $release = $_GET['release']; /*某些环节下起浏览器时会将&符号自动截断,因此这里参数只通过判断字符是否存在来实现*/ foreach ($_GET as $key => $paras) { if ($key == 'cov' && $paras == true || strstr($paras, 'cov=true')) { $cov = true; break; } if ($s = strpos($paras, 'release=')) { $rel = substr($paras, $s + 8, strlen($paras) - 1); $rel = explode('--__--', $rel); $release = $rel[0]; } } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<input id="id_control_runnext" type="checkbox"/>自动下一个<input id="id_control_breakonerror" type="checkbox"/>出错时终止<input id="id_control_clearstatus" type="button" value="清除用例状态" onclick="$J('.testlist a').removeClass('running_case pass_case fail_case');"/> </div> <div> <a id="id_testlist_status" class="button"> <span onclick="$J('div#id_testlist').slideToggle('slow');"> 折叠用例 </span> </a> <a id="id_srconly" class="button"><span onclick="$J('#id_runningarea').slideToggle('slow');">折叠执行</span> </a> </div> <div style="clear: both"></div> <div id="id_testlist" class="testlist"> <?php /*分析所有源码与测试代码js文件一一对应的文件并追加到当前列表中*/ Testcase::listcase($filter); ?> <div style="clear: both; overflow: hidden"></div> </div> <script> /*jiangshuguang 在android2.3和ios4上,用例列表不能滚动 overflow-y: scroll; */ var isIos4= navigator.userAgent.match(/(iPhone\sOS)\s\d+_/)?navigator.userAgent.match(/(iPhone\sOS)\s\d+_/)[0].match(/\d/)[0]==4:false; (/Android.*2\.3/.test(navigator.userAgent) || isIos4) || $J(".testlist").css("max-height","200px"); </script> <div id="id_runningarea" class="runningarea" style="border: solid; display: none"></div> <div id="id_reportarea" class="reportarea" style="display: none;"></div> <div class='clear'></div> <div id="id_showSrcOnly" class="testlist" style="display: none;"> <div class="clear"></div> </div>
public static function listcase($matcher = "*") { require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "../../conf/config.php"; require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'filehelper.php'; $testdir = ConfigTest::$testdir; $caselist = array(); $caselist = array_merge($caselist, getAllFiles($testdir, "\\.js\$", "fet")); foreach ($caselist as $caseitem) { if (!preg_match("/import\\.js/", $caseitem)) { /*将文件名替换为域名方式,替换/为.,移除.js*/ $caseitem = str_replace($testdir, "", $caseitem); //$name = str_replace( '/' , '.' , substr( $caseitem , 0 , -3 ) ); $name = substr($caseitem, 0, -3); //为了支持xx.xx.js类型的文件名而修改 田丽丽 $c = new Testcase($name); if ($c->empty) { continue; } $c->case_id = "id_case_" . str_replace('.', '__', $name); /* jiangshuguang 支持批量过滤,例如filter=webapp只保留webapp的所有的case*/ // if(!strpos($matcher,"/") && $matcher!="*"){ // $mod=explode("/",$name); // if($mod[0]==$matcher){ // print( "<a href=\"run.php?case=$name\" id=\"$c->case_id\" class=\"jsframe_qunit\" target=\"_blank\" title=\"$name\" onclick=\"run('$name');\$J('#id_rerun').html('$name');return false;\">" // . $name . "</a>\n" ); // } // }else{ if ($c->match($matcher)) { print "<a href=\"run.php?case={$name}\" id=\"{$c->case_id}\" class=\"jsframe_qunit\" target=\"_blank\" title=\"{$name}\" onclick=\"run('{$name}');\$J('#id_rerun').html('{$name}');return false;\">" . $name . "</a>\n"; } // } } } }