• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP settings2array函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中settings2array函数的典型用法代码示例。如果您正苦于以下问题:PHP settings2array函数的具体用法?PHP settings2array怎么用?PHP settings2array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了settings2array函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: run_test


//.........这里部分代码省略.........
    // unlink old test results
    @unlink($diff_filename);
    @unlink($log_filename);
    @unlink($exp_filename);
    @unlink($output_filename);
    @unlink($memcheck_filename);
    @unlink($temp_file);
    @unlink($test_file);
    @unlink($temp_skipif);
    @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);
                }
开发者ID:wgy0323,项目名称:ffmpeg-php,代码行数:67,代码来源:run-tests.php


示例2: getEvalTestSettings

 function getEvalTestSettings($section_text, $testfile)
 {
     $rq = array();
     // Any special environment settings
     // these may overwrite the test defaults...
     if ($section_text) {
         $sect = $this->evalSettings($testfile, $section_text);
         //print "data evaled:\n$sect\n";
         settings2array(preg_split("/[\n\r]+/", $sect), $rq);
     }
     return $rq;
 }
开发者ID:browniebraun,项目名称:php-src,代码行数:12,代码来源:server-tests.php


示例3: run_test


//.........这里部分代码省略.........
    $env['PATH_TRANSLATED'] = '';
    $env['SCRIPT_FILENAME'] = '';
    $env['REQUEST_METHOD'] = '';
    $env['CONTENT_TYPE'] = '';
    $env['CONTENT_LENGTH'] = '';
    $env['TZ'] = '';
    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 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)) {
开发者ID:jimjag,项目名称:php-src,代码行数:67,代码来源:run-tests.php


示例4: run_test

function run_test($php, $file)
{
    global $log_format, $info_params, $ini_overwrites, $toDelete;
    if (DETAILED) {
        echo "\n=================\nTEST {$file}\n";
    }
    // Load the sections of the test file.
    $section_text = array('TEST' => '(unnamed test)', 'SKIPIF' => '', 'GET' => '', 'ARGS' => '', 'PCCARGS' => '', 'RTEXPECT' => '');
    $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);
    // if we're running zend type tests, substitute EXPECT for RTEXPECT
    if (getenv('ZEND_COMPAT') == 1) {
        $section_text['RTEXPECT'] = $section_text['EXPECT'];
        $section_text['EXPECT'] = '';
    }
    /* For GET/POST tests, check if cgi sapi is avaliable 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$', '.exp', $file));
    @unlink(ereg_replace('\\.phpt$', '.out', $file));
    @unlink(ereg_replace('\\.phpt$', '.rtout', $file));
    @unlink(ereg_replace('\\.phpt$', '.rtexp', $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
//.........这里部分代码省略.........
开发者ID:jenalgit,项目名称:roadsend-php,代码行数:101,代码来源:run-tests.php


示例5: run_test


//.........这里部分代码省略.........
    $diff_filename = $tmp . DIRECTORY_SEPARATOR . ereg_replace('\\.phpt$', '.diff', basename($file));
    $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($file, $www)
{
    // parse the test '$file'
    $section_text = parse_file($file);
    // setup environment
    if (EndsWith($www, '.php')) {
        $www = dirname($www);
    }
    if (!EndsWith($www, '/')) {
        $www .= '/';
    }
    $phpfile = replace_extension($file, 'php');
    $tested = trim($section_text['TEST']);
    $env = array('HTTP_CONTENT_ENCODING' => '');
    $opts = array('http' => array('method' => "GET", 'header' => ''));
    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();
    // put additional INI settings here
    // 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(realpath($file)), $section_text['INI']);
        }
        settings2array(preg_split("/[\n\r]+/", $section_text['INI']), $ini_settings);
    }
    // prepend custom ini settings
    if (count($ini_settings) > 0) {
        $section_text['FILE'] = get_ini_code($ini_settings) . $section_text['FILE'];
    }
    // skip this test ?
    try_skip($file, $www, $section_text);
    // redirect test ?
    try_redirect($file, $www, $section_text);
    // request .php script
    save_text($phpfile, $section_text['FILE']);
    if (array_key_exists('GET', $section_text)) {
        $query_string = trim($section_text['GET']);
    } else {
        $query_string = '';
    }
    $env['QUERY_STRING'] = $query_string;
    if (array_key_exists('COOKIE', $section_text)) {
        $env['HTTP_COOKIE'] = trim($section_text['COOKIE']);
        $opts["http"]["header"] .= "Cookie: " . $env['HTTP_COOKIE'] . "\r\n";
    } else {
        $env['HTTP_COOKIE'] = '';
    }
    $args = isset($section_text['ARGS']) ? ' -- ' . $section_text['ARGS'] : '';
    if (array_key_exists('POST_RAW', $section_text) && !empty($section_text['POST_RAW'])) {
        $post = trim($section_text['POST_RAW']);
        $raw_lines = explode("\n", $post);
        $request = '';
        $started = false;
        foreach ($raw_lines as $line) {
            if (empty($env['CONTENT_TYPE']) && preg_match('/^Content-Type:(.*)/i', $line, $res)) {
                $env['CONTENT_TYPE'] = trim(str_replace("\r", '', $res[1]));
                continue;
            }
            if ($started) {
                $request .= "\n";
            }
            $started = true;
            $request .= $line;
        }
        $env['CONTENT_LENGTH'] = strlen($request);
        $env['REQUEST_METHOD'] = 'POST';
        $opts["http"]["method"] = "POST";
        $opts["http"]["header"] .= "Content-type: " . $env['CONTENT_TYPE'] . "\r\n";
        $opts["http"]["content"] = $request;
        if (empty($request)) {
            error("POST empty in '{$file}'");
        }
    } else {
        if (array_key_exists('POST', $section_text) && !empty($section_text['POST'])) {
            $post = trim($section_text['POST']);
            if (array_key_exists('GZIP_POST', $section_text) && function_exists('gzencode')) {
                $post = gzencode($post, 9, FORCE_GZIP);
                $env['HTTP_CONTENT_ENCODING'] = 'gzip';
            } else {
                if (array_key_exists('DEFLATE_POST', $section_text) && function_exists('gzcompress')) {
                    $post = gzcompress($post, 9);
                    $env['HTTP_CONTENT_ENCODING'] = 'deflate';
                }
            }
            //save_text($tmp_post, $post);
            $content_length = strlen($post);
            $env['REQUEST_METHOD'] = 'POST';
            $env['CONTENT_TYPE'] = 'application/x-www-form-urlencoded';
            $env['CONTENT_LENGTH'] = $content_length;
            $opts["http"]["method"] = "POST";
            $opts["http"]["header"] .= "Content-type: " . $env['CONTENT_TYPE'] . "\r\n";
            $opts["http"]["header"] .= "Content-encoding: " . $env['HTTP_CONTENT_ENCODING'] . "\r\n";
//.........这里部分代码省略.........
开发者ID:dw4dev,项目名称:Phalanger,代码行数:101,代码来源:index.php


示例7: 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


示例8: run_test


//.........这里部分代码省略.........
    // unlink old test results
    @unlink($diff_filename);
    @unlink($log_filename);
    @unlink($exp_filename);
    @unlink($output_filename);
    @unlink($memcheck_filename);
    @unlink($temp_file);
    @unlink($test_file);
    @unlink($temp_skipif);
    @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);
                }
开发者ID:akhan786,项目名称:LaunchDevelopment,代码行数:67,代码来源:run-tests.php



注:本文中的settings2array函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP settings2params函数代码示例发布时间:2022-05-15
下一篇:
PHP settings函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap