當前位置: 首頁>>代碼示例>>PHP>>正文


PHP run_test函數代碼示例

本文整理匯總了PHP中run_test函數的典型用法代碼示例。如果您正苦於以下問題:PHP run_test函數的具體用法?PHP run_test怎麽用?PHP run_test使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了run_test函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: process_line

function process_line($line)
{
    global $ua, $num_skipped;
    if (preg_match('!^#!', $line)) {
        return;
    } else {
        if (preg_match('!^\\t!', $line)) {
            $line = trim($line);
            if (is_null($ua)) {
                echo "found match line with no UA: {$line}\n";
                return;
            }
            $parts = preg_split('!\\s+!', $line);
            run_test($ua, $parts);
            $ua = null;
        } else {
            if ($ua) {
                $num_skipped++;
            }
            $line = trim($line);
            if (strlen($line)) {
                $ua = $line;
            } else {
                $ua = null;
            }
        }
    }
}
開發者ID:Gehirnfussel,項目名稱:flamework-useragent,代碼行數:28,代碼來源:test.php

示例2: dirname

<?php

$dir = dirname(__FILE__);
function run_test($name)
{
    $args = array('verbose' => true);
    require_once $name . ".php";
}
require "{$dir}/../tpt/tpt/tpt.php";
require "{$dir}/../monty/bootstrap.php";
run_test("App");
run_test("Model");
開發者ID:russpos,項目名稱:php-monty,代碼行數:12,代碼來源:all.php

示例3: key

    public function key()
    {
        return key($this->data);
    }
    public function next()
    {
        next($this->data);
    }
    public function rewind()
    {
        echo "hagfish\n";
        reset($this->data);
    }
    public function valid()
    {
        return current($this->data);
    }
}
function run_test()
{
    $f = new Foo();
    foreach ($f as $value) {
        echo $value . "\n";
    }
    (yield 1230);
    foreach ($f as $value) {
        echo $value . "\n";
    }
}
foreach (run_test() as $_) {
}
開發者ID:badlamer,項目名稱:hhvm,代碼行數:31,代碼來源:2184.php

示例4: println

println();
println("Unit testing csv {$csv_name} against bin {$bin_name}");
println();
println();
println("----------- NO CACHING ------------------");
$ip2c = new ip2country($bin_name);
run_test($ip2c, $csv_name);
// this one caused problems before
$ip2c->get_country('10.0.0.1');
$ip2c->get_country('192.116.192.9');
println("------------------------------------");
println();
println();
println("----------- CACHING ------------------");
$ip2c = new ip2country($bin_name, true);
run_test($ip2c, $csv_name);
// this one caused problems before
$ip2c->get_country('10.0.0.1');
$ip2c->get_country('192.116.192.9');
println("------------------------------------");
function run_test($ip2c, $csvFile)
{
    global $num;
    global $total;
    $num = 0;
    $total = 0;
    $csv = fopen(dirname(__FILE__) . "/{$csvFile}", "r");
    if (!$csv) {
        ip2c_die("Error opening {$csvfile}");
    }
    $row = 0;
開發者ID:hinaloe,項目名稱:crazy-bone,代碼行數:31,代碼來源:ip2c_test.php

示例5: benchmark_autorun

function benchmark_autorun()
{
    $benchmarkGroups = array();
    // add all benchmarks
    foreach (get_declared_classes() as $klass) {
        $reflector = new ReflectionClass($klass);
        if (preg_match("/.benchmark.php\$/", $reflector->getFileName())) {
            foreach ($reflector->getMethods() as $method) {
                if (preg_match("/^test_/", $method->name) === 0) {
                    continue;
                }
                $benchmarkGroups[$klass][] = $method;
            }
        }
    }
    if (!isset($_GET['action'])) {
        $_GET['action'] = 'display_runner';
    }
    switch ($_GET['action']) {
        case "run":
            run_test($_GET['class'], $_GET['method']);
            break;
        default:
            display_runner($benchmarkGroups);
            break;
    }
}
開發者ID:nnnnathann,項目名稱:piwik,代碼行數:27,代碼來源:benchmark_runner.php

示例6: run_all_tests

function run_all_tests($test_files, $env, $redir_tested = null)
{
    global $test_results, $failed_tests_file, $php, $test_cnt, $test_idx;
    foreach ($test_files as $name) {
        if (is_array($name)) {
            $index = "# {$name['1']}: {$name['0']}";
            if ($redir_tested) {
                $name = $name[0];
            }
        } else {
            if ($redir_tested) {
                $index = "# {$redir_tested}: {$name}";
            } else {
                $index = $name;
            }
        }
        $test_idx++;
        $result = run_test($php, $name, $env);
        if (!is_array($name) && $result != 'REDIR') {
            $test_results[$index] = $result;
            if ($failed_tests_file && ($result == 'XFAILED' || $result == 'FAILED' || $result == 'WARNED' || $result == 'LEAKED')) {
                fwrite($failed_tests_file, "{$index}\n");
            }
        }
    }
}
開發者ID:wgy0323,項目名稱:ffmpeg-php,代碼行數:26,代碼來源:run-tests.php

示例7: do_test

function do_test($filename)
{
    global $result_dir, $verbose, $n_test, $n_pass, $n_fail;
    # Get the test name (xyz) from the filename (/path/to/xyz.ext).
    # This is also used to build the stdout and stderr names.
    # Note: PATHINFO_FILENAME was added in PHP-5.2.
    $test_name = pathinfo($filename, PATHINFO_FILENAME);
    # Make sure the test script exists.
    if (!is_readable($filename)) {
        test_fail($test_name, "Script not found: {$filename}\n");
        return;
    }
    $output_file = $result_dir . DIRECTORY_SEPARATOR . $test_name . '.out';
    $error_file = $result_dir . DIRECTORY_SEPARATOR . $test_name . '.err';
    if ($verbose > 1) {
        lecho("Test: {$test_name}\n" . "  Script: {$filename}\n" . "  Output to: {$output_file}\n" . "  Errors to: {$error_file}\n");
    }
    # Run the test, and handle the result (pass, fail, or skip):
    $n_test++;
    run_test($test_name, $filename, $output_file, $error_file);
}
開發者ID:myfarms,項目名稱:PHPlot,代碼行數:21,代碼來源:run_test.php

示例8: strpos

{
    global $cwd;
    $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();
echo "TIME START " . date('Y-m-d H:i:s', $start_time) . "\n=====================================================================\n";
foreach ($test_files as $name) {
    $test_results[$name] = run_test($php, $name);
}
$end_time = time();
// Summarize results
if (0 == count($test_results)) {
    echo "No tests were run.\n";
    return;
}
$n_total = count($test_results);
$n_total += $ignored_by_ext;
$sum_results = array('PASSED' => 0, 'WARNED' => 0, 'SKIPPED' => 0, 'FAILED' => 0);
foreach ($test_results as $v) {
    $sum_results[$v]++;
}
$sum_results['SKIPPED'] += $ignored_by_ext;
$percent_results = array();
開發者ID:jenalgit,項目名稱:roadsend-php,代碼行數:31,代碼來源:run-tests.php

示例9: run_all_tests

function run_all_tests($test_files, $redir_tested = NULL)
{
    global $test_results, $failed_tests_file, $php, $test_cnt, $test_idx;
    foreach ($test_files as $name) {
        $index = is_array($name) ? $name[0] : $name;
        $test_idx++;
        $result = run_test($php, $name);
        if (!is_array($name) && $result != 'REDIR') {
            $test_results[$index] = $result;
            if ($failed_tests_file && ($result == 'FAILED' || $result == 'WARNED')) {
                if ($redir_tested) {
                    fwrite($failed_tests_file, "# {$redir_tested}: {$name}\n");
                } else {
                    fwrite($failed_tests_file, "{$name}\n");
                }
            }
        }
    }
}
開發者ID:justinhernandez,項目名稱:convert,代碼行數:19,代碼來源:run-tests.php

示例10: emit_js_array

    ?>
        <ul id='list'>
        </ul>
        <script type="text/javascript">
            files = <?php 
    emit_js_array(&$test_files);
    ?>
;
        </script>		
        <?php 
}
if (isset($_GET['test'])) {
    //
    // run specified test
    //
    run_test($_GET['test'], $_GET['location']);
} else {
    ?>
    <html><head>
        <title>PHPT Phalanger Tester</title>
        <script type="text/javascript" src="jquery-1.6.2.min.js"></script>
        <script type="text/javascript" src="tests.js"></script>
        <style>
            .state{display:none;}
            .error{color:#f0f;}
            .pass{color:#0f0;}
            .fail{color:#f00;}
            .skip{color:#888;}
        </style>
    </head><body>
    <?php 
開發者ID:dw4dev,項目名稱:Phalanger,代碼行數:31,代碼來源:index.php

示例11: usage

if ($argc > 1) {
    if ($argv[1] == "-h" || $argv[1] == "help") {
        usage();
        return false;
    }
    // run only tests specified
    $tests = array_splice($argv, 1);
    foreach ($tests as $testname) {
        if (run_test($testname)) {
            $succeeded++;
        } else {
            $failed++;
        }
    }
} else {
    foreach ($ALL_TESTS as $testname) {
        if (run_test($testname)) {
            $succeeded++;
        } else {
            $failed++;
        }
    }
}
print "{$succeeded} tests passed, {$failed} tests failed.\n";
if ($succeeded && !$failed) {
    print "SUCCESS\n";
    return true;
} else {
    print "FAILED\n";
    return false;
}
開發者ID:cgvarela,項目名稱:scribe,代碼行數:31,代碼來源:testsuite.php

示例12: roundme

    <tr class="orange">
      <td>&nbsp;</td>
      <?php 
    for ($ff = 0; $ff < $looper; $ff++) {
        ?>
       <td> <?php 
        echo roundme($first + ($time_3[$ff] - $time_2[$ff]) + ($time_4[$ff] - $time_3[$ff]) + ($time_5[$ff] - $time_4[$ff]));
        ?>
 </td>
      <?php 
    }
    ?>
    </tr>
  </tbody>
</table>
<br><br>


<?php 
}
function roundme($value, $nums = 6)
{
    return round($value, $nums);
}
for ($all_t = 1; $all_t <= 2; $all_t++) {
    run_test($all_t);
}
?>


</body>
開發者ID:evansonbiwot,項目名稱:stressdb,代碼行數:31,代碼來源:Mysql.php

示例13: switch

    ?>
                <a class="btn btn-secondary" href="<?php 
    echo $url;
    ?>
&do=philgo-banner">배너</a>
            <?php 
}
?>

    </nav>

    <div class="of-content jumbotron">
        <?php 
switch (http_input('do')) {
    case 'test':
        return run_test();
    case 'model-list':
    case 'install':
    case 'uninstall':
        include sys()->template('model-list');
        return;
    case 'entity-list':
        include sys()->template('entity-list');
        return;
    case 'file-upload-test':
        include sys()->template('file-upload-test');
        return;
    case 'philgo-banner':
        return include sys()->template('philgo-banner');
    default:
        echo '<h1>No action</h1>';
開發者ID:thruthesky,項目名稱:overframe,代碼行數:31,代碼來源:overframe-index-page.php

示例14: run_test

function run_test($php, $file, $test_cnt, $test_idx)
{
    global $log_format, $info_params, $ini_overwrites, $cwd, $PHP_FAILED_TESTS, $pass_options, $DETAILED, $IN_REDIRECT;
    if ($DETAILED) {
        echo "\n=================\nTEST {$file}\n";
    }
    // Load the sections of the test file.
    $section_text = array('TEST' => '', 'SKIPIF' => '', 'GET' => '', 'ARGS' => '');
    $fp = @fopen($file, "r") or error("Cannot open test file: {$file}");
    $borked = false;
    $bork_info = '';
    if (!feof($fp)) {
        $line = fgets($fp);
    } else {
        $bork_info = "empty test [{$file}]";
        $borked = true;
    }
    if (!ereg('^--TEST--', $line, $r)) {
        $bork_info = "tests must start with --TEST-- [{$file}]";
        $borked = true;
    }
    $section = 'TEST';
    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;
    }
    // the redirect section allows a set of tests to be reused outside of
    // a given test dir
    if (@count($section_text['REDIRECTTEST']) == 1) {
        if ($IN_REDIRECT) {
            $borked = true;
            $bork_info = "Can't redirect a test from within a redirected test";
        } else {
            $borked = false;
        }
    } else {
        if (@count($section_text['FILE']) != 1) {
            $bork_info = "missing section --FILE-- [{$file}]";
            $borked = true;
        }
        if (@count($section_text['EXPECT']) + @count($section_text['EXPECTF']) + @count($section_text['EXPECTREGEX']) != 1) {
            $bork_info = "missing section --EXPECT--, --EXPECTF-- or --EXPECTREGEX-- [{$file}]";
            $borked = true;
            print_r($section_text);
        }
    }
    fclose($fp);
    if ($borked) {
        echo "BORK {$bork_info} [{$file}]\n";
        $PHP_FAILED_TESTS['BORKED'][] = array('name' => $file, 'test_name' => '', 'output' => '', 'diff' => '', 'info' => $bork_info);
        return 'BORKED';
    }
    /* 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($cwd . '/', '', $file);
    $tested = trim($section_text['TEST']) . " [{$shortname}]";
    echo "TEST {$test_idx}/{$test_cnt} [{$shortname}]\r";
    flush();
    if (is_array($IN_REDIRECT)) {
        $tmp = $IN_REDIRECT['dir'];
    } else {
        $tmp = realpath(dirname($file));
    }
    $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=");
//.........這裏部分代碼省略.........
開發者ID:BackupTheBerlios,項目名稱:php-qt-svn,代碼行數:101,代碼來源:run-tests.php

示例15: run_stress_tests

function run_stress_tests($server, $debug = 0, $output = null)
{
    global $wiki_dmap;
    run_no_param_test($server, $debug, $output, "wiki.getRPCVersionSupported");
    // of the last day:
    run_test($server, $debug, $output, "wiki.getRecentChanges", iso8601_encode(time() - 86400, 1));
    /* ... */
}
開發者ID:neymanna,項目名稱:fusionforge,代碼行數:8,代碼來源:xmlrpc-client.php


注:本文中的run_test函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。