本文整理汇总了PHP中run_all_tests函数的典型用法代码示例。如果您正苦于以下问题:PHP run_all_tests函数的具体用法?PHP run_all_tests怎么用?PHP run_all_tests使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run_all_tests函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run_all_tests
function run_all_tests($base)
{
foreach (glob("{$base}/*Test.php") as $file) {
require_once $file;
}
foreach (glob("{$base}/*", GLOB_ONLYDIR) as $dir) {
run_all_tests($dir);
}
}
示例2: run_test
//.........这里部分代码省略.........
}
if (!strncasecmp('warn', ltrim($output), 4)) {
if (preg_match('/^\\s*warn\\s*(.+)\\s*/i', $output, $m)) {
$warn = true;
/* only if there is a reason */
$info = " (warn: {$m['1']})";
}
}
}
}
if (@count($section_text['REDIRECTTEST']) == 1) {
$test_files = array();
$IN_REDIRECT = eval($section_text['REDIRECTTEST']);
$IN_REDIRECT['via'] = "via [{$shortname}]\n\t";
$IN_REDIRECT['dir'] = realpath(dirname($file));
$IN_REDIRECT['prefix'] = trim($section_text['TEST']);
if (count($IN_REDIRECT['TESTS']) == 1) {
if (is_array($org_file)) {
$test_files[] = $org_file[1];
} else {
$GLOBALS['test_files'] = $test_files;
find_files($IN_REDIRECT['TESTS']);
foreach ($GLOBALS['test_files'] as $f) {
$test_files[] = array($f, $file);
}
}
$test_cnt += @count($test_files) - 1;
$test_idx--;
show_redirect_start($IN_REDIRECT['TESTS'], $tested, $tested_file);
// set up environment
$redirenv = array_merge($environment, $IN_REDIRECT['ENV']);
$redirenv['REDIR_TEST_DIR'] = realpath($IN_REDIRECT['TESTS']) . DIRECTORY_SEPARATOR;
usort($test_files, "test_sort");
run_all_tests($test_files, $redirenv, $tested);
show_redirect_ends($IN_REDIRECT['TESTS'], $tested, $tested_file);
// a redirected test never fails
$IN_REDIRECT = false;
return 'REDIR';
} else {
$bork_info = "Redirect info must contain exactly one TEST string to be used as redirect directory.";
show_result("BORK", $bork_info, '', $temp_filenames);
$PHP_FAILED_TESTS['BORKED'][] = array('name' => $file, 'test_name' => '', 'output' => '', 'diff' => '', 'info' => "{$bork_info} [{$file}]");
}
}
if (is_array($org_file) || @count($section_text['REDIRECTTEST']) == 1) {
if (is_array($org_file)) {
$file = $org_file[0];
}
$bork_info = "Redirected test did not contain redirection info";
show_result("BORK", $bork_info, '', $temp_filenames);
$PHP_FAILED_TESTS['BORKED'][] = array('name' => $file, 'test_name' => '', 'output' => '', 'diff' => '', 'info' => "{$bork_info} [{$file}]");
return 'BORKED';
}
// We've satisfied the preconditions - run the test!
show_file_block('php', $section_text['FILE'], 'TEST');
save_text($test_file, $section_text['FILE'], $temp_file);
if (array_key_exists('GET', $section_text)) {
$query_string = trim($section_text['GET']);
} else {
$query_string = '';
}
$env['REDIRECT_STATUS'] = '1';
$env['QUERY_STRING'] = $query_string;
$env['PATH_TRANSLATED'] = $test_file;
$env['SCRIPT_FILENAME'] = $test_file;
if (array_key_exists('COOKIE', $section_text)) {
示例3: define
require_once "scripts/switches.php";
require_once "scripts/wiki_lib.php";
define("TEST_BUCKET", "<<TEST_BUCKET>>");
define("TEST_FILE", "test_file");
define("TEST_KEY", "test_key");
define("TEST_VALUE", "test_value");
$trailing = $argv[1];
$dest = $argv[2];
$alias = $argv[3];
if ($alias == "~event-test") {
set_bucket(TEST_BUCKET, TEST_VALUE);
term_echo("*** ~event-test: TEST BUCKET ==> " . get_bucket(TEST_BUCKET));
return;
}
$passed = True;
run_all_tests();
if ($passed == True) {
privmsg("all tests passed!");
} else {
privmsg("one or more tests failed! (specific errors output to terminal)");
}
#####################################################################################################
function run_all_tests()
{
run_event_registration_test();
sleep(3);
run_append_array_bucket_test();
sleep(3);
run_array_bucket_element_file_test();
sleep(3);
run_user_tracking_test();
示例4: run_test
//.........这里部分代码省略.........
}
}
}
}
if (!extension_loaded("zlib") && (array_key_exists("GZIP_POST", $section_text) || array_key_exists("DEFLATE_POST", $section_text))) {
$message = "ext/zlib required";
show_result('SKIP', $tested, $tested_file, "reason: {$message}", $temp_filenames);
junit_mark_test_as('SKIP', $shortname, $tested, null, $message);
return 'SKIPPED';
}
if (@count($section_text['REDIRECTTEST']) == 1) {
$test_files = array();
$IN_REDIRECT = eval($section_text['REDIRECTTEST']);
$IN_REDIRECT['via'] = "via [{$shortname}]\n\t";
$IN_REDIRECT['dir'] = realpath(dirname($file));
$IN_REDIRECT['prefix'] = trim($section_text['TEST']);
if (!empty($IN_REDIRECT['TESTS'])) {
if (is_array($org_file)) {
$test_files[] = $org_file[1];
} else {
$GLOBALS['test_files'] = $test_files;
find_files($IN_REDIRECT['TESTS']);
foreach ($GLOBALS['test_files'] as $f) {
$test_files[] = array($f, $file);
}
}
$test_cnt += @count($test_files) - 1;
$test_idx--;
show_redirect_start($IN_REDIRECT['TESTS'], $tested, $tested_file);
// set up environment
$redirenv = array_merge($environment, $IN_REDIRECT['ENV']);
$redirenv['REDIR_TEST_DIR'] = realpath($IN_REDIRECT['TESTS']) . DIRECTORY_SEPARATOR;
usort($test_files, "test_sort");
run_all_tests($test_files, $redirenv, $tested);
show_redirect_ends($IN_REDIRECT['TESTS'], $tested, $tested_file);
// a redirected test never fails
$IN_REDIRECT = false;
junit_mark_test_as('PASS', $shortname, $tested);
return 'REDIR';
} else {
$bork_info = "Redirect info must contain exactly one TEST string to be used as redirect directory.";
show_result("BORK", $bork_info, '', $temp_filenames);
$PHP_FAILED_TESTS['BORKED'][] = array('name' => $file, 'test_name' => '', 'output' => '', 'diff' => '', 'info' => "{$bork_info} [{$file}]");
}
}
if (is_array($org_file) || @count($section_text['REDIRECTTEST']) == 1) {
if (is_array($org_file)) {
$file = $org_file[0];
}
$bork_info = "Redirected test did not contain redirection info";
show_result("BORK", $bork_info, '', $temp_filenames);
$PHP_FAILED_TESTS['BORKED'][] = array('name' => $file, 'test_name' => '', 'output' => '', 'diff' => '', 'info' => "{$bork_info} [{$file}]");
junit_mark_test_as('BORK', $shortname, $tested, null, $bork_info);
return 'BORKED';
}
// We've satisfied the preconditions - run the test!
if (isset($section_text['FILE'])) {
show_file_block('php', $section_text['FILE'], 'TEST');
save_text($test_file, $section_text['FILE'], $temp_file);
} else {
$test_file = $temp_file = "";
}
if (array_key_exists('GET', $section_text)) {
$query_string = trim($section_text['GET']);
} else {
$query_string = '';
示例5: test_name
$b = test_name($b);
$ta = strpos($a, "{$cwd}/tests") === 0 ? 1 + (strpos($a, "{$cwd}/tests/run-test") === 0 ? 1 : 0) : 0;
$tb = strpos($b, "{$cwd}/tests") === 0 ? 1 + (strpos($b, "{$cwd}/tests/run-test") === 0 ? 1 : 0) : 0;
if ($ta == $tb) {
return strcmp($a, $b);
} else {
return $tb - $ta;
}
}
$test_files = array_unique($test_files);
usort($test_files, "test_sort");
$start_time = time();
show_start($start_time);
$test_cnt = count($test_files);
$test_idx = 0;
run_all_tests($test_files, $environment);
$end_time = time();
if ($failed_tests_file) {
fclose($failed_tests_file);
}
// Summarize results
if (0 == count($test_results)) {
echo "No tests were run.\n";
return;
}
compute_summary();
show_end($end_time);
show_summary();
if ($html_output) {
fclose($html_file);
}
示例6: run_test
//.........这里部分代码省略.........
}
if (eregi("^warn", trim($output))) {
$reason = ereg("^warn[[:space:]]*(.+)\$", trim($output)) ? ereg_replace("^warn[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE;
if ($reason) {
$warn = true;
/* only if there is a reason */
$info = " (warn: {$reason})";
}
}
}
}
if (@count($section_text['REDIRECTTEST']) == 1) {
$test_files = array();
$IN_REDIRECT = eval($section_text['REDIRECTTEST']);
$IN_REDIRECT['via'] = "via [{$shortname}]\n\t";
$IN_REDIRECT['dir'] = realpath(dirname($file));
$IN_REDIRECT['prefix'] = trim($section_text['TEST']);
if (is_array($org_file)) {
$test_files[] = $org_file[1];
} else {
$GLOBALS['test_files'] = $test_files;
find_files($IN_REDIRECT['TESTS']);
$test_files = $GLOBALS['test_files'];
}
$test_cnt += count($test_files) - 1;
$test_idx--;
echo "---> {$IN_REDIRECT['TESTS']} ({$tested})\n";
// set up environment
foreach ($IN_REDIRECT['ENV'] as $k => $v) {
putenv("{$k}={$v}");
}
putenv("REDIR_TEST_DIR=" . realpath($IN_REDIRECT['TESTS']) . DIRECTORY_SEPARATOR);
usort($test_files, "test_sort");
run_all_tests($test_files, $tested);
echo "---> {$IN_REDIRECT['TESTS']} ({$tested}) done\n";
// clean up environment
foreach ($IN_REDIRECT['ENV'] as $k => $v) {
putenv("{$k}=");
}
putenv("REDIR_TEST_DIR=");
// a redirected test never fails
$IN_REDIRECT = false;
return 'REDIR';
} else {
if (is_array($org_file)) {
echo "--> Redirected test did not contain redirection info: {$org_file['0']}\n";
$test_cnt -= 1;
$test_idx--;
return 'REDIR';
}
}
// Default ini settings
$ini_settings = array();
// additional ini overwrites
//$ini_overwrites[] = 'setting=value';
settings2array($ini_overwrites, $ini_settings);
// Any special ini settings
// these may overwrite the test defaults...
if (array_key_exists('INI', $section_text)) {
settings2array(preg_split("/[\n\r]+/", $section_text['INI']), $ini_settings);
}
settings2params($ini_settings);
// We've satisfied the preconditions - run the test!
save_text($tmp_file, $section_text['FILE']);
if (array_key_exists('GET', $section_text)) {
$query_string = trim($section_text['GET']);
示例7: run_test
//.........这里部分代码省略.........
if (!strncasecmp('warn', trim($output), 4)) {
$reason = ereg("^warn[[:space:]]*(.+)\$", trim($output)) ? ereg_replace("^warn[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE;
if ($reason) {
$warn = true;
/* only if there is a reason */
$info = " (warn: {$reason})";
}
}
}
}
if (@count($section_text['REDIRECTTEST']) == 1) {
$test_files = array();
$IN_REDIRECT = eval($section_text['REDIRECTTEST']);
$IN_REDIRECT['via'] = "via [{$shortname}]\n\t";
$IN_REDIRECT['dir'] = realpath(dirname($file));
$IN_REDIRECT['prefix'] = trim($section_text['TEST']);
if (@count($IN_REDIRECT['TESTS']) == 1) {
if (is_array($org_file)) {
$test_files[] = $org_file[1];
} else {
$GLOBALS['test_files'] = $test_files;
find_files($IN_REDIRECT['TESTS']);
foreach ($GLOBALS['test_files'] as $f) {
$test_files[] = array($f, $file);
}
}
$test_cnt += count($test_files) - 1;
$test_idx--;
show_redirect_start($IN_REDIRECT['TESTS'], $tested, $tested_file);
// set up environment
$redirenv = array_merge($environment, $IN_REDIRECT['ENV']);
$redirenv['REDIR_TEST_DIR'] = realpath($IN_REDIRECT['TESTS']) . DIRECTORY_SEPARATOR;
usort($test_files, "test_sort");
run_all_tests($test_files, $redirenv, $tested);
show_redirect_ends($IN_REDIRECT['TESTS'], $tested, $tested_file);
// a redirected test never fails
$IN_REDIRECT = false;
return 'REDIR';
}
}
if (is_array($org_file) || @count($section_text['REDIRECTTEST']) == 1) {
if (is_array($org_file)) {
$file = $org_file[0];
}
$bork_info = "Redirected test did not contain redirection info";
show_result("BORK", $bork_info, '', $temp_filenames);
$PHP_FAILED_TESTS['BORKED'][] = array('name' => $file, 'test_name' => '', 'output' => '', 'diff' => '', 'info' => "{$bork_info} [{$file}]");
//$test_cnt -= 1; // Only if is_array($org_file) ?
//$test_idx--;
return 'BORKED';
}
// We've satisfied the preconditions - run the test!
if ($cfg['show']['php']) {
echo "\n========TEST========\n";
echo $section_text['FILE'];
echo "========DONE========\n";
}
save_text($test_file, $section_text['FILE'], $temp_file);
if (array_key_exists('GET', $section_text)) {
$query_string = trim($section_text['GET']);
} else {
$query_string = '';
}
$env['REDIRECT_STATUS'] = '1';
$env['QUERY_STRING'] = $query_string;
$env['PATH_TRANSLATED'] = $test_file;