public static function listcase($matcher = "*", $projroot = '../../../') { $srcpath = $projroot . 'src/'; $testpath = $projroot . 'test/'; require_once 'filehelper.php'; $caselist = getSameFile($srcpath, $testpath, ''); foreach ($caselist as $caseitem) { /*将文件名替换为域名方式,替换/为.,移除.js*/ $name = str_replace('/', '.', substr($caseitem, 0, -3)); $c = new Kiss($projroot, $name); if ($c->empty) { continue; } if ($c->match($matcher)) { print "<a href=\"run.php?case={$name}\" id=\"{$c->case_id}\" path=\"{$caseitem}\"" . "class=\"jsframe_qunit\" target=\"_blank\" title=\"{$name}\" >" . substr($name, 6) . "</a>\n"; } } }
public static function listcase($matcher="*", $projroot = '../../../'){ $srcpath = $projroot.'src/'; $testpath = $projroot.'test/'; require_once 'filehelper.php'; $caselist = getSameFile($srcpath, $testpath, ''); foreach($caselist as $caseitem){ /*将文件名替换为域名方式,替换/为.,移除.js*/ $name = str_replace('/','.',substr($caseitem,0, -3)); $c = new Kiss($projroot, $name); if($c->empty) continue; if($c->match($matcher)){ print("<a href=\"run.php?case=$name\" id=\"$c->case_id\" path=\"$caseitem\"" ."class=\"jsframe_qunit\" target=\"_blank\" title=\"$name\" >" /*过长的时候屏蔽超出20的部分,因为隐藏的处理,所有用例不能 * 直接使用标签a中的innerHTML,而应该使用title */ .substr($name, 6)."</a>\n"); } } }
public static function listcase($matcher = "*", $projroot = '../../../') { $srcpath = $projroot . '_src/'; $testpath = $projroot . '_test/'; require_once 'filehelper.php'; $caselist = getSameFile($srcpath, $testpath, ''); //默认取src和test下的同名文件 foreach (Config::$special_Case as $s_caseitem => $s_source) { //设置在源码路径下没有同名文件对应的测试文件 array_push($caselist, $s_caseitem); } sort($caselist, SORT_STRING); foreach ($caselist as $caseitem) { /*将文件名替换为域名方式,替换/为.,移除.js*/ //$name = str_replace( '/' , '.' , substr( $caseitem , 0 , -3 ) ); $name = substr($caseitem, 0, -3); //为了支持xx.xx.js类型的文件名而修改 田丽丽 $c = new Kiss($projroot, $name); if ($c->empty) { continue; } if ($c->match($matcher)) { $newName = explode('\\.', $name); $newName = $newName[count($newName) - 1]; print "<a href=\"run.php?case={$name}\" id=\"{$c->case_id}\" class=\"jsframe_qunit\" target=\"_blank\" title=\"{$name}\" onclick=\"run('{$name}');\$('#id_rerun').html('{$name}');return false;\">" . $newName . "</a>\n"; } } }
public static function listcase($matcher = "*", $cov) { require_once 'fileHelper.php'; /*get files both in src path and test path*/ $caselist = getSameFile(Config::$projroot . Config::$src_PATH, Config::$projroot . Config::$test_PATH, ''); sort($caselist, SORT_STRING); foreach ($caselist as $caseitem) { /*remove '.js' */ $name = substr($caseitem, 0, -3); $c = new Kiss($name); if ($c->empty) { continue; } if ($c->match($matcher)) { $newName = explode('\\.', $name); $newName = $newName[count($newName) - 1]; if ($cov) { $covMsg = "&cov=true"; } else { $covMsg = ""; } print "<a href=\"run.php?case={$name}" . $covMsg . "\" id=\"{$c->case_id}\" target=\"_blank\" title=\"{$name}\" onclick=\"run('{$name}');return false;\">" . $newName . "</a>"; } } }