diff options
author | Hartmut Holzgraefe <hholzgra@php.net> | 2000-10-23 07:40:05 +0000 |
---|---|---|
committer | Hartmut Holzgraefe <hholzgra@php.net> | 2000-10-23 07:40:05 +0000 |
commit | 86c0d81253f62414384c6c92f9283e545dfccfc7 (patch) | |
tree | 87e002242eebe3f695c4c2fd12d2ad84f57913a2 | |
parent | b17451635d4a7c3392aad8adadca31d36410514c (diff) | |
download | php-git-86c0d81253f62414384c6c92f9283e545dfccfc7.tar.gz |
have you ever tried to run the regression tests with error_reporting=E_ALL ?
now it will run smoothly without all theese 'undefined ...' warnings
-rw-r--r-- | ext/db/tests/001.phpt | 2 | ||||
-rw-r--r-- | ext/db/tests/002.phpt | 2 | ||||
-rw-r--r-- | ext/db/tests/003.phpt | 2 | ||||
-rw-r--r-- | ext/db/tests/004.phpt | 2 | ||||
-rw-r--r-- | ext/db/tests/005.phpt | 2 | ||||
-rw-r--r-- | ext/db/tests/006.phpt | 2 | ||||
-rwxr-xr-x | run-tests.php | 34 | ||||
-rw-r--r-- | tests/lang/022.phpt | 4 | ||||
-rwxr-xr-x | tests/lang/023-1.inc | 10 | ||||
-rw-r--r-- | tests/lang/024.phpt | 10 |
10 files changed, 43 insertions, 27 deletions
diff --git a/ext/db/tests/001.phpt b/ext/db/tests/001.phpt index 9792bfef35..ea95d3d70a 100644 --- a/ext/db/tests/001.phpt +++ b/ext/db/tests/001.phpt @@ -1,5 +1,7 @@ --TEST-- DBM File Creation Test +--SKIPIF-- +<?php if (!extension_loaded("db")) print "skip"; ?> --POST-- --GET-- --FILE-- diff --git a/ext/db/tests/002.phpt b/ext/db/tests/002.phpt index 99e66e9568..d0bc710f08 100644 --- a/ext/db/tests/002.phpt +++ b/ext/db/tests/002.phpt @@ -1,5 +1,7 @@ --TEST-- DBM Insert/Fetch Test +--SKIPIF-- +<?php if (!extension_loaded("db")) print "skip"; ?> --POST-- --GET-- --FILE-- diff --git a/ext/db/tests/003.phpt b/ext/db/tests/003.phpt index ec639a02a7..319325c398 100644 --- a/ext/db/tests/003.phpt +++ b/ext/db/tests/003.phpt @@ -1,5 +1,7 @@ --TEST-- DBM Insert/Replace/Fetch Test +--SKIPIF-- +<?php if (!extension_loaded("db")) print "skip"; ?> --POST-- --GET-- --FILE-- diff --git a/ext/db/tests/004.phpt b/ext/db/tests/004.phpt index 561bd0be63..1becfcfdcd 100644 --- a/ext/db/tests/004.phpt +++ b/ext/db/tests/004.phpt @@ -1,5 +1,7 @@ --TEST-- DBM Multiple Insert/Fetch Test +--SKIPIF-- +<?php if (!extension_loaded("db")) print "skip"; ?> --POST-- --GET-- --FILE-- diff --git a/ext/db/tests/005.phpt b/ext/db/tests/005.phpt index 90ca126272..de33201883 100644 --- a/ext/db/tests/005.phpt +++ b/ext/db/tests/005.phpt @@ -1,5 +1,7 @@ --TEST-- DBM FirstKey/NextKey Loop Test With 5 Items +--SKIPIF-- +<?php if (!extension_loaded("db")) print "skip"; ?> --POST-- --GET-- --FILE-- diff --git a/ext/db/tests/006.phpt b/ext/db/tests/006.phpt index 3654095a59..3428ce3948 100644 --- a/ext/db/tests/006.phpt +++ b/ext/db/tests/006.phpt @@ -1,5 +1,7 @@ --TEST-- DBM FirstKey/NextKey with 2 deletes +--SKIPIF-- +<?php if (!extension_loaded("db")) print "skip"; ?> --POST-- --GET-- --FILE-- diff --git a/run-tests.php b/run-tests.php index 6b6e895e03..16929f511d 100755 --- a/run-tests.php +++ b/run-tests.php @@ -18,6 +18,7 @@ +----------------------------------------------------------------------+ */ +ob_implicit_flush(); define('TEST_PASSED', 0); define('TEST_FAILED', -1); @@ -191,7 +192,7 @@ function find_testdirs($dir = '.', $first_pass = true) { } while ($ent = readdir($dp)) { $path = "$dir/$ent"; - if ($skip[$ent] || substr($ent, 0, 1) == "." || !is_dir($path)) { + if ((isset($skip[$ent]) && $skip[$ent]) || substr($ent, 0, 1) == "." || !is_dir($path)) { continue; } if (strstr("/$path/", "/tests/")) { @@ -211,14 +212,14 @@ function run_tests_in_dir($dir = '.') { } $testfiles = array(); while ($ent = readdir($dp)) { - if ($skip[$ent] || substr($ent, 0, 1) == "." || substr($ent, -5) != ".phpt") { + if ((isset($skip[$ent]) && $skip[$ent]) || substr($ent, 0, 1) == "." || substr($ent, -5) != ".phpt") { continue; } $testfiles[] = "$dir/$ent"; - $tests_in_dir[$dir]++; + if(isset($tests_in_dir[$dir])) $tests_in_dir[$dir]++; else $tests_in_dir[$dir]=1; } closedir($dp); - if ($tests_in_dir[$dir] == 0) { + if (isset($tests_in_dir[$dir]) && ($tests_in_dir[$dir] == 0)) { return true; } $oskipped = $skipped; @@ -240,7 +241,7 @@ function run_tests_in_dir($dir = '.') { } $total++; } - if ($oskipped + $tests_in_dir[$dir] == $skipped) { + if ($oskipped + (isset($tests_in_dir[$dir])?$tests_in_dir[$dir]:0) == $skipped) { writeln("(all skipped)"); } writeln(""); @@ -275,6 +276,7 @@ function delete_tmpfiles() { * @return bool whether the files were "equal" */ function compare_results($file1, $file2) { + $data1 = $data2 = ""; if (!($fp1 = @fopen($file1, "r")) || !($fp2 = @fopen($file2, "r"))) { return false; } @@ -318,17 +320,17 @@ function run_test($file) { while ($line = fgets($fp, 4096)) { if (preg_match('/^--([A-Z]+)--$/', $line, $matches)) { $var = $matches[1]; - if ($tmpfile[$var]) { + if (isset($tmpfile[$var]) && $tmpfile[$var]) { $fps[$var] = @fopen($tmpfile[$var], "w"); } else { $$var = ''; } } else { - if ($var) { + if (isset($var) && $var) { if ($var == "POST") { $line = trim($line); } - if ($fps[$var]) { + if (isset($fps[$var]) && $fps[$var]) { fwrite($fps[$var], $line); } else { $$var .= $line; @@ -336,16 +338,18 @@ function run_test($file) { } } } - reset($fps); - while (list($k, $v) = each($fps)) { - if (is_resource($v)) { - fclose($v); - } + if(isset($fps) && is_array($fps)) { + reset($fps); + while (list($k, $v) = each($fps)) { + if (is_resource($v)) { + fclose($v); + } + } } putenv("PHP_TEST=1"); putenv("REDIRECT_STATUS=1"); putenv("CONTENT_LENGTH="); - putenv("QUERY_STRING=$GET"); + putenv("QUERY_STRING=".(isset($GET)?$GET:"")); if (isset($fps["SKIPIF"])) { $tmpfile["SKIPIF_OUTPUT"] = tempnam($tmpdir, $tmpfix); putenv("REQUEST_METHOD=GET"); @@ -403,7 +407,7 @@ function run_test($file) { } fclose($ofp); pclose($cp); - $desc = trim($TEST); + $desc = isset($test)?trim($TEST):""; $outfile = preg_replace('/\.phpt$/', '.out', $file); $expectfile = preg_replace('/\.phpt$/', '.exp', $file); $phpfile = preg_replace('/\.phpt$/', '.php', $file); diff --git a/tests/lang/022.phpt b/tests/lang/022.phpt index 072d66f085..d70ea0e28d 100644 --- a/tests/lang/022.phpt +++ b/tests/lang/022.phpt @@ -11,10 +11,10 @@ cfunction switchtest ($i, $j) case 0: switch($j) { case 0: - echo zero; + echo "zero"; break; case 1: - echo one; + echo "one"; break; default: echo $j; diff --git a/tests/lang/023-1.inc b/tests/lang/023-1.inc index 7fa22ea414..8d52e844c9 100755 --- a/tests/lang/023-1.inc +++ b/tests/lang/023-1.inc @@ -226,7 +226,7 @@ while ($i<$arr_len) { while ($j<$arr_len) { $k=0; while ($k<$arr_len) { - ${test.$i.$j}[$k] = $i+$j+$k; + ${"test$i$j"}[$k] = $i+$j+$k; $k++; } $j++; @@ -275,17 +275,17 @@ echo "commented out..."; *** Hash resizing test ***<br> <?php $i = 10; -$a = b; +$a = 'b'; while ($i > 0) { - $a = $a . a; + $a = $a . 'a'; echo "$a<br>\n"; $resize[$a] = $i; $i--; } $i = 10; -$a = b; +$a = 'b'; while ($i > 0) { - $a = $a . a; + $a = $a . 'a'; echo "$a<br>\n"; echo $resize[$a]."<br>\n"; $i--; diff --git a/tests/lang/024.phpt b/tests/lang/024.phpt index 542a7853af..5c8024dc7e 100644 --- a/tests/lang/024.phpt +++ b/tests/lang/024.phpt @@ -245,7 +245,7 @@ while ($i<$arr_len) { while ($j<$arr_len) { $k=0; while ($k<$arr_len) { - ${test.$i.$j}[$k] = $i+$j+$k; + ${"test$i$j"}[$k] = $i+$j+$k; $k++; } $j++; @@ -294,17 +294,17 @@ echo "commented out..."; *** Hash resizing test *** <?php $i = 10; -$a = b; +$a = "b"; while ($i > 0) { - $a = $a . a; + $a = $a . "a"; echo "$a\n"; $resize[$a] = $i; $i--; } $i = 10; -$a = b; +$a = "b"; while ($i > 0) { - $a = $a . a; + $a = $a . "a"; echo "$a\n"; echo $resize[$a]."\n"; $i--; |