本文整理汇总了PHP中settings2params函数的典型用法代码示例。如果您正苦于以下问题:PHP settings2params函数的具体用法?PHP settings2params怎么用?PHP settings2params使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了settings2params函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: run_test
//.........这里部分代码省略.........
if (!empty($e[0]) && isset($e[1])) {
$env[$e[0]] = $e[1];
}
}
}
// Default ini settings
$ini_settings = array();
// Additional required extensions
if (array_key_exists('EXTENSIONS', $section_text)) {
$ext_dir = `{$php} -r 'echo ini_get("extension_dir");'`;
$extensions = preg_split("/[\n\r]+/", trim($section_text['EXTENSIONS']));
$loaded = explode(",", `{$php} -n -r 'echo implode(",", get_loaded_extensions());'`);
foreach ($extensions as $req_ext) {
if (!in_array($req_ext, $loaded)) {
if ($req_ext == 'opcache') {
$ini_settings['zend_extension'][] = $ext_dir . DIRECTORY_SEPARATOR . $req_ext . '.' . PHP_SHLIB_SUFFIX;
} else {
$ini_settings['extension'][] = $ext_dir . DIRECTORY_SEPARATOR . $req_ext . '.' . PHP_SHLIB_SUFFIX;
}
}
}
}
// 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)) {
if (strpos($section_text['INI'], '{PWD}') !== false) {
$section_text['INI'] = str_replace('{PWD}', dirname($file), $section_text['INI']);
}
settings2array(preg_split("/[\n\r]+/", $section_text['INI']), $ini_settings);
}
settings2params($ini_settings);
// Check if test should be skipped.
$info = '';
$warn = false;
if (array_key_exists('SKIPIF', $section_text)) {
if (trim($section_text['SKIPIF'])) {
show_file_block('skip', $section_text['SKIPIF']);
save_text($test_skipif, $section_text['SKIPIF'], $temp_skipif);
$extra = substr(PHP_OS, 0, 3) !== "WIN" ? "unset REQUEST_METHOD; unset QUERY_STRING; unset PATH_TRANSLATED; unset SCRIPT_FILENAME; unset REQUEST_METHOD;" : "";
if ($leak_check) {
$env['USE_ZEND_ALLOC'] = '0';
$env['ZEND_DONT_UNLOAD_MODULES'] = 1;
} else {
$env['USE_ZEND_ALLOC'] = '1';
$env['ZEND_DONT_UNLOAD_MODULES'] = 0;
}
junit_start_timer($shortname);
$output = system_with_timeout("{$extra} {$php} {$pass_options} -q {$ini_settings} {$no_file_cache} -d display_errors=0 \"{$test_skipif}\"", $env);
junit_finish_timer($shortname);
if (!$cfg['keep']['skip']) {
@unlink($test_skipif);
}
if (!strncasecmp('skip', ltrim($output), 4)) {
if (preg_match('/^\\s*skip\\s*(.+)\\s*/i', $output, $m)) {
show_result('SKIP', $tested, $tested_file, "reason: {$m['1']}", $temp_filenames);
} else {
show_result('SKIP', $tested, $tested_file, '', $temp_filenames);
}
if (!$cfg['keep']['skip']) {
@unlink($test_skipif);
}
$message = !empty($m[1]) ? $m[1] : '';
junit_mark_test_as('SKIP', $shortname, $tested, null, $message);
开发者ID:jimjag,项目名称:php-src,代码行数:67,代码来源:run-tests.php
示例2: run_test
//.........这里部分代码省略.........
@unlink($test_skipif);
@unlink($tmp_post);
@unlink($temp_clean);
@unlink($test_clean);
// Reset environment from any previous test.
$env['REDIRECT_STATUS'] = '';
$env['QUERY_STRING'] = '';
$env['PATH_TRANSLATED'] = '';
$env['SCRIPT_FILENAME'] = '';
$env['REQUEST_METHOD'] = '';
$env['CONTENT_TYPE'] = '';
$env['CONTENT_LENGTH'] = '';
if (!empty($section_text['ENV'])) {
foreach (explode("\n", trim($section_text['ENV'])) as $e) {
$e = explode('=', trim($e), 2);
if (!empty($e[0]) && isset($e[1])) {
$env[$e[0]] = $e[1];
}
}
}
// 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)) {
if (strpos($section_text['INI'], '{PWD}') !== false) {
$section_text['INI'] = str_replace('{PWD}', dirname($file), $section_text['INI']);
}
settings2array(preg_split("/[\n\r]+/", $section_text['INI']), $ini_settings);
}
settings2params($ini_settings);
// Check if test should be skipped.
$info = '';
$warn = false;
if (array_key_exists('SKIPIF', $section_text)) {
if (trim($section_text['SKIPIF'])) {
show_file_block('skip', $section_text['SKIPIF']);
save_text($test_skipif, $section_text['SKIPIF'], $temp_skipif);
$extra = substr(PHP_OS, 0, 3) !== "WIN" ? "unset REQUEST_METHOD; unset QUERY_STRING; unset PATH_TRANSLATED; unset SCRIPT_FILENAME; unset REQUEST_METHOD;" : "";
if ($leak_check) {
$env['USE_ZEND_ALLOC'] = '0';
} else {
$env['USE_ZEND_ALLOC'] = '1';
}
$output = system_with_timeout("{$extra} {$php} {$pass_options} -q {$ini_settings} {$test_skipif}", $env);
if (!$cfg['keep']['skip']) {
@unlink($test_skipif);
}
if (!strncasecmp('skip', ltrim($output), 4)) {
if (preg_match('/^\\s*skip\\s*(.+)\\s*/i', $output, $m)) {
show_result('SKIP', $tested, $tested_file, "reason: {$m['1']}", $temp_filenames);
} else {
show_result('SKIP', $tested, $tested_file, '', $temp_filenames);
}
if (isset($old_php)) {
$php = $old_php;
}
if (!$cfg['keep']['skip']) {
@unlink($test_skipif);
}
return 'SKIPPED';
}
if (!strncasecmp('info', ltrim($output), 4)) {
开发者ID:wgy0323,项目名称:ffmpeg-php,代码行数:67,代码来源:run-tests.php
示例3: getINIParams
function getINIParams(&$section_text)
{
if (!$section_text) {
return '';
}
// XXX php5 current has a problem doing this in one line
// it fails with Only variables can be passed by reference
// on test ext\calendar\tests\jdtojewish.phpt
// return settings2params($this->getINISettings($section_text));
$ini = $this->getINISettings($section_text);
return settings2params($ini);
}
开发者ID:browniebraun,项目名称:php-src,代码行数:12,代码来源:server-tests.php
示例4: run_test
//.........这里部分代码省略.........
echo "\n";
}
if (isset($old_php)) {
$php = $old_php;
}
return 'SKIPPED';
}
if (eregi("^info", trim($output))) {
$reason = ereg("^info[[:space:]]*(.+)\$", trim($output)) ? ereg_replace("^info[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE;
if ($reason) {
$info = " (info: {$reason})";
}
}
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})";
}
}
}
}
// 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']);
} else {
$query_string = '';
}
putenv("REDIRECT_STATUS=1");
putenv("QUERY_STRING={$query_string}");
putenv("PATH_TRANSLATED={$tmp_file}");
putenv("SCRIPT_FILENAME={$tmp_file}");
$args = $section_text['ARGS'] ? ' -- ' . $section_text['ARGS'] : '';
$pccargs = parseTestFileVars(trim($section_text['PCCARGS']));
if (array_key_exists('POST', $section_text) && !empty($section_text['POST'])) {
$post = trim($section_text['POST']);
save_text($tmp_post, $post);
$content_length = strlen($post);
putenv("REQUEST_METHOD=POST");
putenv("CONTENT_TYPE=application/x-www-form-urlencoded");
putenv("CONTENT_LENGTH={$content_length}");
//$cmd = "$php$ini_settings $pccargs \"$tmp_file\" 2>&1 < $tmp_post";
$cmd = "{$php} {$pccargs} \"{$tmp_file}\" 2>&1 < {$tmp_post}";
} else {
putenv("REQUEST_METHOD=GET");
putenv("CONTENT_TYPE=");
putenv("CONTENT_LENGTH=");
//$cmd = "$php$ini_settings $pccargs \"$tmp_file\" $args 2>&1";
$cmd = "{$php} -d 0 {$pccargs} \"{$tmp_file}\" {$args} 2>&1";
}
if (DETAILED) {
echo "\nCONTENT_LENGTH = " . getenv("CONTENT_LENGTH") . "\nCONTENT_TYPE = " . getenv("CONTENT_TYPE") . "\nPATH_TRANSLATED = " . getenv("PATH_TRANSLATED") . "\nQUERY_STRING = " . getenv("QUERY_STRING") . "\nREDIRECT_STATUS = " . getenv("REDIRECT_STATUS") . "\nREQUEST_METHOD = " . getenv("REQUEST_METHOD") . "\nSCRIPT_FILENAME = " . getenv("SCRIPT_FILENAME") . "\nCOMMAND {$cmd}\n";
}
开发者ID:jenalgit,项目名称:roadsend-php,代码行数:67,代码来源:run-tests.php
示例5: run_test
//.........这里部分代码省略.........
$log_filename = $tmp . DIRECTORY_SEPARATOR . ereg_replace('\\.phpt$', '.log', basename($file));
$exp_filename = $tmp . DIRECTORY_SEPARATOR . ereg_replace('\\.phpt$', '.exp', basename($file));
$output_filename = $tmp . DIRECTORY_SEPARATOR . ereg_replace('\\.phpt$', '.out', basename($file));
$tmp_skipif = $tmp . DIRECTORY_SEPARATOR . uniqid('/phpt.');
$tmp_file = $tmp . DIRECTORY_SEPARATOR . ereg_replace('\\.phpt$', '.php', basename($file));
$tmp_post = $tmp . DIRECTORY_SEPARATOR . uniqid('/phpt.');
if (is_array($IN_REDIRECT)) {
$tested = $IN_REDIRECT['prefix'] . ' ' . trim($section_text['TEST']) . " [{$tmp_file}]";
$section_text['FILE'] = "# original source file: {$shortname}\n" . $section_text['FILE'];
}
@unlink($tmp_skipif);
@unlink($tmp_file);
@unlink($tmp_post);
// unlink old test results
@unlink($diff_filename);
@unlink($log_filename);
@unlink($exp_filename);
@unlink($output_filename);
// Reset environment from any previous test.
putenv("REDIRECT_STATUS=");
putenv("QUERY_STRING=");
putenv("PATH_TRANSLATED=");
putenv("SCRIPT_FILENAME=");
putenv("REQUEST_METHOD=");
putenv("CONTENT_TYPE=");
putenv("CONTENT_LENGTH=");
// Check if test should be skipped.
$info = '';
$warn = false;
if (array_key_exists('SKIPIF', $section_text)) {
if (trim($section_text['SKIPIF'])) {
$skipif_params = array();
settings2array($ini_overwrites, $skipif_params);
settings2params($skipif_params);
save_text($tmp_skipif, $section_text['SKIPIF']);
$extra = substr(PHP_OS, 0, 3) !== "WIN" ? "unset REQUEST_METHOD; unset QUERY_STRING; unset PATH_TRANSLATED; unset SCRIPT_FILENAME; unset REQUEST_METHOD;" : "";
$output = system_with_timeout("{$extra} {$php} -q {$skipif_params} {$tmp_skipif}");
@unlink($tmp_skipif);
if (eregi("^skip", trim($output))) {
echo "SKIP {$tested}";
$reason = eregi("^skip[[:space:]]*(.+)\$", trim($output)) ? eregi_replace("^skip[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE;
if ($reason) {
echo " (reason: {$reason})\n";
} else {
echo "\n";
}
if (isset($old_php)) {
$php = $old_php;
}
return 'SKIPPED';
}
if (eregi("^info", trim($output))) {
$reason = ereg("^info[[:space:]]*(.+)\$", trim($output)) ? ereg_replace("^info[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE;
if ($reason) {
$info = " (info: {$reason})";
}
}
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})";
}
}
}
开发者ID:BackupTheBerlios,项目名称:php-qt-svn,代码行数:67,代码来源:run-tests.php
示例6: run_test
function run_test($php, $file)
{
global $log_format, $info_params, $ini_overwrites;
if (DETAILED) {
echo "\n=================\nTEST {$file}\n";
}
// Load the sections of the test file.
$section_text = array('TEST' => '(unnamed test)', 'SKIPIF' => '', 'GET' => '', 'ARGS' => '');
$fp = @fopen($file, "r") or error("Cannot open test file: {$file}");
$section = '';
while (!feof($fp)) {
$line = fgets($fp);
// Match the beginning of a section.
if (ereg('^--([A-Z]+)--', $line, $r)) {
$section = $r[1];
$section_text[$section] = '';
continue;
}
// Add to the section text.
$section_text[$section] .= $line;
}
fclose($fp);
/* For GET/POST tests, check if cgi sapi is available and if it is, use it. */
if (!empty($section_text['GET']) || !empty($section_text['POST'])) {
if (file_exists("./sapi/cgi/php")) {
$old_php = $php;
$php = realpath("./sapi/cgi/php") . ' -C ';
}
}
$shortname = str_replace($GLOBALS['cwd'] . '/', '', $file);
$tested = trim($section_text['TEST']) . " [{$shortname}]";
$tmp = realpath(dirname($file));
$tmp_skipif = $tmp . uniqid('/phpt.');
$tmp_file = ereg_replace('\\.phpt$', '.php', $file);
$tmp_post = $tmp . uniqid('/phpt.');
@unlink($tmp_skipif);
@unlink($tmp_file);
@unlink($tmp_post);
// unlink old test results
@unlink(ereg_replace('\\.phpt$', '.diff', $file));
@unlink(ereg_replace('\\.phpt$', '.log', $file));
@unlink(ereg_replace('\\.phpt$', '.exp', $file));
@unlink(ereg_replace('\\.phpt$', '.out', $file));
// Reset environment from any previous test.
putenv("REDIRECT_STATUS=");
putenv("QUERY_STRING=");
putenv("PATH_TRANSLATED=");
putenv("SCRIPT_FILENAME=");
putenv("REQUEST_METHOD=");
putenv("CONTENT_TYPE=");
putenv("CONTENT_LENGTH=");
// Check if test should be skipped.
$info = '';
$warn = false;
if (array_key_exists('SKIPIF', $section_text)) {
if (trim($section_text['SKIPIF'])) {
save_text($tmp_skipif, $section_text['SKIPIF']);
$extra = substr(PHP_OS, 0, 3) !== "WIN" ? "unset REQUEST_METHOD;" : "";
$output = `{$extra} {$php} {$info_params} -f {$tmp_skipif}`;
@unlink($tmp_skipif);
if (eregi("^skip", trim($output))) {
echo "SKIP {$tested}";
$reason = eregi("^skip[[:space:]]*(.+)\$", trim($output)) ? eregi_replace("^skip[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE;
if ($reason) {
echo " (reason: {$reason})\n";
} else {
echo "\n";
}
if (isset($old_php)) {
$php = $old_php;
}
return 'SKIPPED';
}
if (eregi("^info", trim($output))) {
$reason = ereg("^info[[:space:]]*(.+)\$", trim($output)) ? ereg_replace("^info[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE;
if ($reason) {
$info = " (info: {$reason})";
}
}
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})";
}
}
}
}
// 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);
//.........这里部分代码省略.........
开发者ID:OTiZ,项目名称:osx,代码行数:101,代码来源:run-tests.php
示例7: run_test
//.........这里部分代码省略.........
@unlink($test_skipif);
@unlink($tmp_post);
@unlink($temp_clean);
@unlink($test_clean);
// Reset environment from any previous test.
$env['REDIRECT_STATUS'] = '';
$env['QUERY_STRING'] = '';
$env['PATH_TRANSLATED'] = '';
$env['SCRIPT_FILENAME'] = '';
$env['REQUEST_METHOD'] = '';
$env['CONTENT_TYPE'] = '';
$env['CONTENT_LENGTH'] = '';
if (!empty($section_text['ENV'])) {
foreach (explode("\n", $section_text['ENV']) as $e) {
$e = explode('=', trim($e));
if (count($e) == 2) {
$env[$e[0]] = $e[1];
}
}
}
// 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)) {
if (strpos($section_text['INI'], '{PWD}') !== false) {
$section_text['INI'] = str_replace('{PWD}', dirname($file), $section_text['INI']);
}
settings2array(preg_split("/[\n\r]+/", $section_text['INI']), $ini_settings);
}
settings2params($ini_settings);
// Check if test should be skipped.
$info = '';
$warn = false;
if (array_key_exists('SKIPIF', $section_text)) {
if (trim($section_text['SKIPIF'])) {
if ($cfg['show']['skip']) {
echo "\n========SKIP========\n";
echo $section_text['SKIPIF'];
echo "========DONE========\n";
}
save_text($test_skipif, $section_text['SKIPIF'], $temp_skipif);
$extra = substr(PHP_OS, 0, 3) !== "WIN" ? "unset REQUEST_METHOD; unset QUERY_STRING; unset PATH_TRANSLATED; unset SCRIPT_FILENAME; unset REQUEST_METHOD;" : "";
$output = system_with_timeout("{$extra} {$php} -q {$ini_settings} {$test_skipif}", $env);
if (!$cfg['keep']['skip']) {
@unlink($test_skipif);
}
if (!strncasecmp('skip', trim($output), 4)) {
$reason = eregi("^skip[[:space:]]*(.+)\$", trim($output)) ? eregi_replace("^skip[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE;
if ($reason) {
show_result("SKIP", $tested, $tested_file, "reason: {$reason}", $temp_filenames);
} else {
show_result("SKIP", $tested, $tested_file, '', $temp_filenames);
}
if (isset($old_php)) {
$php = $old_php;
}
if (!$cfg['keep']['skip']) {
@unlink($test_skipif);
}
return 'SKIPPED';
}
if (!strncasecmp('info', trim($output), 4)) {
开发者ID:akhan786,项目名称:LaunchDevelopment,代码行数:67,代码来源:run-tests.php
注:本文中的settings2params函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论