From d189ffac79f8fc71997118fc704451ac817a04b1 Mon Sep 17 00:00:00 2001 From: Zoe Slattery Date: Fri, 23 Jan 2009 09:21:25 +0000 Subject: [PATCH] fix tests --- .../tests/file/fopen_variation17.phpt | 29 ++++++------ ext/standard/tests/file/fopen_variation5.phpt | 42 +++++------------- ext/standard/tests/file/fopen_variation7.phpt | 20 ++++----- ext/standard/tests/file/fopen_variation8.phpt | 44 +++++-------------- ext/standard/tests/file/fopen_variation9.phpt | 21 ++++----- 5 files changed, 52 insertions(+), 104 deletions(-) diff --git a/ext/standard/tests/file/fopen_variation17.phpt b/ext/standard/tests/file/fopen_variation17.phpt index a565d7dffa..75f24b3553 100644 --- a/ext/standard/tests/file/fopen_variation17.phpt +++ b/ext/standard/tests/file/fopen_variation17.phpt @@ -2,8 +2,6 @@ Test fopen() function : variation: use include path create and read a file (relative) --CREDITS-- Dave Kelsey ---XFAIL-- -Bug #46680 --FILE-- ===DONE=== --EXPECT-- -*** Testing fopen() : variation *** -created in dir1 -found file again in dir1 -created in dir1 -found file again in dir1 +Not created in dir1 +found file for reading +Not created in dir1 +found file for reading ===DONE=== diff --git a/ext/standard/tests/file/fopen_variation5.phpt b/ext/standard/tests/file/fopen_variation5.phpt index 9a47708f3e..975560f5ce 100644 --- a/ext/standard/tests/file/fopen_variation5.phpt +++ b/ext/standard/tests/file/fopen_variation5.phpt @@ -1,7 +1,5 @@ --TEST-- Test fopen() function : variation: use include path and stream context (absolute directories in path) ---XFAIL-- -Pending completion of Unicode streams --CREDITS-- Dave Kelsey --FILE-- @@ -14,14 +12,13 @@ Dave Kelsey -echo "*** Testing fopen() : variation ***\n"; //create the include directory structure -$thisTestDir = "fopenVariation5.dir"; +$thisTestDir = basename(__FILE__, ".php") . ".dir"; mkdir($thisTestDir); chdir($thisTestDir); $workingDir = "workdir"; -$filename = "afile.txt"; +$filename = basename(__FILE__, ".php") . ".tmp"; $scriptDir = dirname(__FILE__); $baseDir = getcwd(); $secondFile = $baseDir."/dir2/".$filename; @@ -66,7 +63,7 @@ function test_fopen($mode) { // create a file in the middle directory $h = fopen($secondFile, "w"); - fwrite($h, "in dir2"); + fwrite($h, (binary) "in dir2"); fclose($h); echo "\n** testing with mode=$mode **\n"; @@ -78,7 +75,7 @@ function test_fopen($mode) { //create a file in dir1 $h = fopen($firstFile, "w"); - fwrite($h, "in dir1"); + fwrite($h, (binary) "in dir1"); fclose($h); //should now read dir1 file @@ -89,7 +86,7 @@ function test_fopen($mode) { // create a file in working directory $h = fopen($filename, "w"); - fwrite($h, "in working dir"); + fwrite($h, (binary) "in working dir"); fclose($h); //should still read dir1 file @@ -101,7 +98,7 @@ function test_fopen($mode) { unlink($firstFile); unlink($secondFile); - //should fail to read the file + //should read the file in working dir $h = fopen($filename, $mode, true); fpassthru($h); fclose($h); @@ -109,7 +106,7 @@ function test_fopen($mode) { // create a file in the script directory $h = fopen($scriptFile, "w"); - fwrite($h, "in script dir"); + fwrite($h, (binary) "in script dir"); fclose($h); //should read the file in script dir @@ -127,7 +124,6 @@ function test_fopen($mode) { ?> ===DONE=== --EXPECTF-- -*** Testing fopen() : variation *** --- testing include path --- @@ -135,39 +131,21 @@ function test_fopen($mode) { in dir2 in dir1 in dir1 - -Warning: fopen(afile.txt): failed to open stream: No such file or directory in %s on line %d - -Warning: fpassthru(): supplied argument is not a valid stream resource in %s on line %d - -Warning: fclose(): supplied argument is not a valid stream resource in %s on line %d - +in working dir in script dir ** testing with mode=r+ ** in dir2 in dir1 in dir1 - -Warning: fopen(afile.txt): failed to open stream: No such file or directory in %s on line %d - -Warning: fpassthru(): supplied argument is not a valid stream resource in %s on line %d - -Warning: fclose(): supplied argument is not a valid stream resource in %s on line %d - +in working dir in script dir ** testing with mode=rt ** in dir2 in dir1 in dir1 - -Warning: fopen(afile.txt): failed to open stream: No such file or directory in %s on line %d - -Warning: fpassthru(): supplied argument is not a valid stream resource in %s on line %d - -Warning: fclose(): supplied argument is not a valid stream resource in %s on line %d - +in working dir in script dir ===DONE=== diff --git a/ext/standard/tests/file/fopen_variation7.phpt b/ext/standard/tests/file/fopen_variation7.phpt index 08ba2d61b8..13f075cfff 100644 --- a/ext/standard/tests/file/fopen_variation7.phpt +++ b/ext/standard/tests/file/fopen_variation7.phpt @@ -1,7 +1,5 @@ --TEST-- Test fopen() function : variation: use include path create a file (relative) ---XFAIL-- -Pending completion of Unicode streams --CREDITS-- Dave Kelsey --FILE-- @@ -14,8 +12,7 @@ Dave Kelsey require_once('fopen_include_path.inc'); -echo "*** Testing fopen() : variation ***\n"; -$thisTestDir = "fopenVariation7.dir"; +$thisTestDir = basename(__FILE__, ".php") . ".dir"; mkdir($thisTestDir); chdir($thisTestDir); @@ -33,9 +30,9 @@ rmdir($thisTestDir); function runtest() { global $dir1; - $tmpfile = 'fopen_variation7.tmp'; + $tmpfile = basename(__FILE__, ".php") . ".tmp"; $h = fopen($tmpfile, "w", true); - fwrite($h, "This is the test file"); + fwrite($h, (binary)"This is the test file"); fclose($h); @@ -49,7 +46,7 @@ function runtest() { unlink($tmpfile); } - $h = fopen($dir1.'/'.$tmpfile, "r"); + $h = @fopen($dir1.'/'.$tmpfile, "r"); if ($h === false) { echo "Not created in dir1\n"; } @@ -62,9 +59,8 @@ function runtest() { ?> ===DONE=== --EXPECT-- -*** Testing fopen() : variation *** -Not created in working dir -created in dir1 -Not created in working dir -created in dir1 +created in working dir +Not created in dir1 +created in working dir +Not created in dir1 ===DONE=== diff --git a/ext/standard/tests/file/fopen_variation8.phpt b/ext/standard/tests/file/fopen_variation8.phpt index b142641adc..dd95014ff3 100644 --- a/ext/standard/tests/file/fopen_variation8.phpt +++ b/ext/standard/tests/file/fopen_variation8.phpt @@ -1,7 +1,5 @@ --TEST-- Test fopen() function : variation: use include path and stream context (relative directories in path) ---XFAIL-- -Pending completion of Unicode streams --CREDITS-- Dave Kelsey --FILE-- @@ -14,14 +12,13 @@ Dave Kelsey -echo "*** Testing fopen() : variation ***\n"; -$thisTestDir = "fopenVariation8.dir"; +$thisTestDir = basename(__FILE__, ".php") . ".dir"; mkdir($thisTestDir); chdir($thisTestDir); //create the include directory structure $workingDir = "workdir"; -$filename = "afile.txt"; +$filename = basename(__FILE__, ".php") . ".tmp"; $scriptDir = dirname(__FILE__); $baseDir = getcwd(); $secondFile = $baseDir."/dir2/".$filename; @@ -65,7 +62,7 @@ function test_fopen($mode) { // create a file in the middle directory $h = fopen($secondFile, "w"); - fwrite($h, "in dir2"); + fwrite($h, (binary) "in dir2"); fclose($h); echo "\n** testing with mode=$mode **\n"; @@ -77,7 +74,7 @@ function test_fopen($mode) { //create a file in dir1 $h = fopen($firstFile, "w"); - fwrite($h, "in dir1"); + fwrite($h, (binary) "in dir1"); fclose($h); //should now read dir1 file @@ -88,10 +85,10 @@ function test_fopen($mode) { // create a file in working directory $h = fopen($filename, "w"); - fwrite($h, "in working dir"); + fwrite($h, (binary) "in working dir"); fclose($h); - //should still read dir1 file + //should read the dir1 file $h = fopen($filename, $mode, true); fpassthru($h); fclose($h); @@ -100,7 +97,7 @@ function test_fopen($mode) { unlink($firstFile); unlink($secondFile); - //should fail to read the file + //should read the working dir file $h = fopen($filename, $mode, true); fpassthru($h); fclose($h); @@ -108,7 +105,7 @@ function test_fopen($mode) { // create a file in the script directory $h = fopen($scriptFile, "w"); - fwrite($h, "in script dir"); + fwrite($h, (binary) "in script dir"); fclose($h); //should read the file in script dir @@ -126,7 +123,6 @@ function test_fopen($mode) { ?> ===DONE=== --EXPECTF-- -*** Testing fopen() : variation *** --- testing include path --- @@ -134,39 +130,21 @@ function test_fopen($mode) { in dir2 in dir1 in dir1 - -Warning: fopen(afile.txt): failed to open stream: No such file or directory in %s on line %d - -Warning: fpassthru(): supplied argument is not a valid stream resource in %s on line %d - -Warning: fclose(): supplied argument is not a valid stream resource in %s on line %d - +in working dir in script dir ** testing with mode=r+ ** in dir2 in dir1 in dir1 - -Warning: fopen(afile.txt): failed to open stream: No such file or directory in %s on line %d - -Warning: fpassthru(): supplied argument is not a valid stream resource in %s on line %d - -Warning: fclose(): supplied argument is not a valid stream resource in %s on line %d - +in working dir in script dir ** testing with mode=rt ** in dir2 in dir1 in dir1 - -Warning: fopen(afile.txt): failed to open stream: No such file or directory in %s on line %d - -Warning: fpassthru(): supplied argument is not a valid stream resource in %s on line %d - -Warning: fclose(): supplied argument is not a valid stream resource in %s on line %d - +in working dir in script dir ===DONE=== diff --git a/ext/standard/tests/file/fopen_variation9.phpt b/ext/standard/tests/file/fopen_variation9.phpt index f144b22563..4b0a7270db 100644 --- a/ext/standard/tests/file/fopen_variation9.phpt +++ b/ext/standard/tests/file/fopen_variation9.phpt @@ -1,7 +1,5 @@ --TEST-- Test fopen() function : variation: use include path and stream context create a file, relative path ---XFAIL-- -Pending completion of Unicode streams --CREDITS-- Dave Kelsey --FILE-- @@ -14,14 +12,14 @@ Dave Kelsey require_once('fopen_include_path.inc'); -echo "*** Testing fopen() : variation ***\n"; -$thisTestDir = "fopenVariation9.dir"; +$thisTestDir = basename(__FILE__, ".php") . ".dir"; mkdir($thisTestDir); chdir($thisTestDir); $newpath = relative_include_path(); set_include_path($newpath); runtest(); + $newpath = generate_next_rel_path(); set_include_path($newpath); runtest(); @@ -32,9 +30,9 @@ chdir(".."); rmdir($thisTestDir); function runtest() { - $tmpfile = 'fopen_variation7.tmp'; + $tmpfile = basename(__FILE__, ".php") . ".tmp"; $h = fopen($tmpfile, "w", true); - fwrite($h, "This is the test file"); + fwrite($h, (binary) "This is the test file"); fclose($h); @@ -48,7 +46,7 @@ function runtest() { unlink($tmpfile); } - $h = fopen('dir1/'.$tmpfile, "r"); + $h = @fopen('dir1/'.$tmpfile, "r"); if ($h === false) { echo "Not created in dir1\n"; } @@ -61,9 +59,8 @@ function runtest() { ?> ===DONE=== --EXPECT-- -*** Testing fopen() : variation *** -Not created in working dir -created in dir1 -Not created in working dir -created in dir1 +created in working dir +Not created in dir1 +created in working dir +Not created in dir1 ===DONE=== -- 2.40.0