zoe Fri Jan 23 09:21:26 2009 UTC
Modified files:
/php-src/ext/standard/tests/file fopen_variation5.phpt
fopen_variation17.phpt
fopen_variation8.phpt
fopen_variation7.phpt
fopen_variation9.phpt
Log:
fix tests
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fopen_variation5.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/standard/tests/file/fopen_variation5.phpt
diff -u php-src/ext/standard/tests/file/fopen_variation5.phpt:1.2
php-src/ext/standard/tests/file/fopen_variation5.phpt:1.3
--- php-src/ext/standard/tests/file/fopen_variation5.phpt:1.2 Wed Nov 26
17:48:40 2008
+++ php-src/ext/standard/tests/file/fopen_variation5.phpt Fri Jan 23
09:21:25 2009
@@ -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 <[email protected]>
--FILE--
@@ -14,14 +12,13 @@
-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 @@
// 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 @@
//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 @@
// 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 @@
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 @@
// 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 @@
?>
===DONE===
--EXPECTF--
-*** Testing fopen() : variation ***
--- testing include path ---
@@ -135,39 +131,21 @@
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===
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fopen_variation17.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/standard/tests/file/fopen_variation17.phpt
diff -u php-src/ext/standard/tests/file/fopen_variation17.phpt:1.3
php-src/ext/standard/tests/file/fopen_variation17.phpt:1.4
--- php-src/ext/standard/tests/file/fopen_variation17.phpt:1.3 Wed Dec 3
12:39:54 2008
+++ php-src/ext/standard/tests/file/fopen_variation17.phpt Fri Jan 23
09:21:25 2009
@@ -2,8 +2,6 @@
Test fopen() function : variation: use include path create and read a file
(relative)
--CREDITS--
Dave Kelsey <[email protected]>
---XFAIL--
-Bug #46680
--FILE--
<?php
/* Prototype : resource fopen(string filename, string mode [, bool
use_include_path [, resource context]])
@@ -14,14 +12,14 @@
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 @@
$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 @@
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===
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fopen_variation8.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/standard/tests/file/fopen_variation8.phpt
diff -u php-src/ext/standard/tests/file/fopen_variation8.phpt:1.2
php-src/ext/standard/tests/file/fopen_variation8.phpt:1.3
--- php-src/ext/standard/tests/file/fopen_variation8.phpt:1.2 Wed Nov 26
17:48:40 2008
+++ php-src/ext/standard/tests/file/fopen_variation8.phpt Fri Jan 23
09:21:25 2009
@@ -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 <[email protected]>
--FILE--
@@ -14,14 +12,13 @@
-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 @@
// 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 @@
//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 @@
// 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 @@
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 @@
// 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 @@
?>
===DONE===
--EXPECTF--
-*** Testing fopen() : variation ***
--- testing include path ---
@@ -134,39 +130,21 @@
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===
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fopen_variation7.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/standard/tests/file/fopen_variation7.phpt
diff -u php-src/ext/standard/tests/file/fopen_variation7.phpt:1.2
php-src/ext/standard/tests/file/fopen_variation7.phpt:1.3
--- php-src/ext/standard/tests/file/fopen_variation7.phpt:1.2 Wed Nov 26
17:48:41 2008
+++ php-src/ext/standard/tests/file/fopen_variation7.phpt Fri Jan 23
09:21:25 2009
@@ -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 <[email protected]>
--FILE--
@@ -14,8 +12,7 @@
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 @@
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 @@
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 @@
?>
===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===
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fopen_variation9.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/standard/tests/file/fopen_variation9.phpt
diff -u php-src/ext/standard/tests/file/fopen_variation9.phpt:1.2
php-src/ext/standard/tests/file/fopen_variation9.phpt:1.3
--- php-src/ext/standard/tests/file/fopen_variation9.phpt:1.2 Wed Nov 26
17:48:41 2008
+++ php-src/ext/standard/tests/file/fopen_variation9.phpt Fri Jan 23
09:21:25 2009
@@ -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 <[email protected]>
--FILE--
@@ -14,14 +12,14 @@
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 @@
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 @@
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 @@
?>
===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===
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php