diff options
author | Zoe Slattery <zoe@php.net> | 2009-01-23 09:23:22 +0000 |
---|---|---|
committer | Zoe Slattery <zoe@php.net> | 2009-01-23 09:23:22 +0000 |
commit | e7c8c5d526790ebe3c3bfb77357e9a6708c7428e (patch) | |
tree | 67265f8912f66da49aa5bbab4a83ab7039449f76 /ext/standard/tests/file | |
parent | d8ab16b68346ec3a1636db166cc577196ccdf56c (diff) | |
download | php-git-e7c8c5d526790ebe3c3bfb77357e9a6708c7428e.tar.gz |
fix tests
Diffstat (limited to 'ext/standard/tests/file')
-rw-r--r-- | ext/standard/tests/file/fopen_variation17.phpt | 29 | ||||
-rw-r--r-- | ext/standard/tests/file/fopen_variation5.phpt | 42 | ||||
-rw-r--r-- | ext/standard/tests/file/fopen_variation7.phpt | 20 | ||||
-rw-r--r-- | ext/standard/tests/file/fopen_variation8.phpt | 44 | ||||
-rw-r--r-- | 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 <d_kelsey@uk.ibm.com> ---XFAIL-- -Bug #46680 --FILE-- <?php /* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]]) @@ -14,14 +12,14 @@ Bug #46680 require_once('fopen_include_path.inc'); -echo "*** Testing fopen() : variation ***\n"; -$thisTestDir = "fopenVariation17.dir"; +$thisTestDir = basename(__FILE__, ".php") . ".dir"; mkdir($thisTestDir); chdir($thisTestDir); $newpath = create_include_path(); set_include_path($newpath); runtest(); + $newpath = generate_next_path(); set_include_path($newpath); runtest(); @@ -37,13 +35,14 @@ function runtest() { $extraDir = "extraDir"; mkdir($dir1.'/'.$extraDir); + mkdir($extraDir); - $tmpfile = $extraDir.'/fopen_variation17.tmp'; + $tmpfile = $extraDir.'/ 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); - $h = fopen($dir1.'/'.$tmpfile, "r"); + $h = @fopen($dir1.'/'.$tmpfile, "r"); if ($h === false) { echo "Not created in dir1\n"; } @@ -57,19 +56,19 @@ function runtest() { echo "could not find file for reading\n"; } else { - echo "found file again in dir1\n"; + echo "found file for reading\n"; fclose($h); } - unlink($dir1.'/'.$tmpfile); - rmdir($dir1.'/'.$extraDir); + unlink($tmpfile); + rmdir($dir1.'/'.$extraDir); + rmdir($extraDir); } ?> ===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 00fde79aff..975560f5ce 100644 --- a/ext/standard/tests/file/fopen_variation5.phpt +++ b/ext/standard/tests/file/fopen_variation5.phpt @@ -2,8 +2,6 @@ Test fopen() function : variation: use include path and stream context (absolute directories in path) --CREDITS-- Dave Kelsey <d_kelsey@uk.ibm.com> ---XFAIL-- -Bug #46680 --FILE-- <?php /* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]]) @@ -14,14 +12,13 @@ Bug #46680 -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 40c515e574..13f075cfff 100644 --- a/ext/standard/tests/file/fopen_variation7.phpt +++ b/ext/standard/tests/file/fopen_variation7.phpt @@ -2,8 +2,6 @@ Test fopen() function : variation: use include path create a file (relative) --CREDITS-- Dave Kelsey <d_kelsey@uk.ibm.com> ---XFAIL-- -Bug #46680 --FILE-- <?php /* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]]) @@ -14,8 +12,7 @@ Bug #46680 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 249c505f2c..dd95014ff3 100644 --- a/ext/standard/tests/file/fopen_variation8.phpt +++ b/ext/standard/tests/file/fopen_variation8.phpt @@ -2,8 +2,6 @@ Test fopen() function : variation: use include path and stream context (relative directories in path) --CREDITS-- Dave Kelsey <d_kelsey@uk.ibm.com> ---XFAIL-- -Bug #46680 --FILE-- <?php /* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]]) @@ -14,14 +12,13 @@ Bug #46680 -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 e067211d53..4b0a7270db 100644 --- a/ext/standard/tests/file/fopen_variation9.phpt +++ b/ext/standard/tests/file/fopen_variation9.phpt @@ -2,8 +2,6 @@ Test fopen() function : variation: use include path and stream context create a file, relative path --CREDITS-- Dave Kelsey <d_kelsey@uk.ibm.com> ---XFAIL-- -Bug #46680 --FILE-- <?php /* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]]) @@ -14,14 +12,14 @@ Bug #46680 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=== |