Annotation of embedaddon/php/ext/standard/tests/file/fopen_variation7.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test fopen() function : variation: use include path create a file (relative)
3: --CREDITS--
4: Dave Kelsey <d_kelsey@uk.ibm.com>
5: --FILE--
6: <?php
7: /* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
8: * Description: Open a file or a URL and return a file pointer
9: * Source code: ext/standard/file.c
10: * Alias to functions:
11: */
12:
13: require_once('fopen_include_path.inc');
14:
15: $thisTestDir = basename(__FILE__, ".php") . ".dir";
16: mkdir($thisTestDir);
17: chdir($thisTestDir);
18:
19: $newpath = create_include_path();
20: set_include_path($newpath);
21: runtest();
22: $newpath = generate_next_path();
23: set_include_path($newpath);
24: runtest();
25:
26: teardown_include_path();
27: restore_include_path();
28: chdir("..");
29: rmdir($thisTestDir);
30:
31: function runtest() {
32: global $dir1;
33: $tmpfile = basename(__FILE__, ".php") . ".tmp";
34: $h = fopen($tmpfile, "w", true);
35: fwrite($h, (binary)"This is the test file");
36: fclose($h);
37:
38:
39: $h = @fopen($tmpfile, "r");
40: if ($h === false) {
41: echo "Not created in working dir\n";
42: }
43: else {
44: echo "created in working dir\n";
45: fclose($h);
46: unlink($tmpfile);
47: }
48:
49: $h = @fopen($dir1.'/'.$tmpfile, "r");
50: if ($h === false) {
51: echo "Not created in dir1\n";
52: }
53: else {
54: echo "created in dir1\n";
55: fclose($h);
56: unlink($dir1.'/'.$tmpfile);
57: }
58: }
59: ?>
60: ===DONE===
61: --EXPECT--
62: created in working dir
63: Not created in dir1
64: created in working dir
65: Not created in dir1
66: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>