Annotation of embedaddon/php/ext/standard/tests/file/fopen_variation14-win32.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test fopen() function : variation: file uri, no use include path
3: --CREDITS--
4: Dave Kelsey <d_kelsey@uk.ibm.com>
5: --SKIPIF--
6: <?php
7: if(substr(PHP_OS, 0, 3) != "WIN")
8: die("skip Run only on Windows");
9: ?>
10: --FILE--
11: <?php
12: /* Prototype : resource fopen(string filename, string mode [, bool use_include_path [, resource context]])
13: * Description: Open a file or a URL and return a file pointer
14: * Source code: ext/standard/file.c
15: * Alias to functions:
16: */
17:
18: echo "*** Testing fopen() : variation ***\n";
19:
20: // fopen with interesting windows paths.
21: $testDir = 'fopen14.tmpDir';
22: $absTestDir = getcwd().'/'.$testDir;
23: $file = "fopen_variation14.tmp";
24: $unixifiedDir = '/'.substr(str_replace('\\','/',$absTestDir),3);
25: $absFile = $absTestDir.'/'.$file;
26:
27: mkdir($testDir);
28:
29: $files = array("file://$testDir\\$file",
30: "file://$testDir/$file",
31: "file://./$testDir/$file",
32: "file://.\\$testDir\\$file",
33: "file://$absTestDir/$file",
34: "file://$absTestDir\\$file",
35: "file://$unixifiedDir/$file"
36: );
37:
38: runtest($files);
39:
40: chdir($testDir);
41: $files = array("file://../$testDir/$file",
42: "file://..\\$testDir\\$file",
43: "file://$absTestDir/$file",
44: "file://$absTestDir\\$file",
45: "file://$unixifiedDir/$file"
46: );
47: runtest($files);
48: chdir("..");
49: rmdir($testDir);
50:
51: function runtest($fileURIs) {
52: global $absFile;
53: $iteration = 0;
54: foreach($fileURIs as $fileURI) {
55: echo "--- READ: $fileURI ---\n";
56:
57: $readData = "read:$iteration";
58: $writeData = "write:$iteration";
59:
60: // create the file and test read
61: $h = fopen($absFile, 'w');
62: fwrite($h, $readData);
63: fclose($h);
64:
65: $h = fopen($fileURI, 'r');
66: if ($h !== false) {
67: if (fread($h, 4096) != $readData) {
68: echo "contents not correct\n";
69: }
70: else {
71: echo "test passed\n";
72: }
73: fclose($h);
74: }
75: unlink($absFile);
76:
77: echo "--- WRITE: $fileURI ---\n";
78: // create the file to test write
79: $h = fopen($fileURI, 'w');
80: if ($h !== false) {
81: fwrite($h, $writeData);
82: fclose($h);
83:
84: $h = fopen($absFile, 'r');
85: if ($h !== false) {
86: if (fread($h, 4096) != $writeData) {
87: echo "contents not correct\n";
88: }
89: else {
90: echo "test passed\n";
91: }
92: fclose($h);
93: }
94: unlink($absFile);
95: }
96: }
97: }
98:
99:
100: ?>
101: ===DONE===
102: --EXPECTF--
103: *** Testing fopen() : variation ***
104: --- READ: file://fopen14.tmpDir\fopen_variation14.tmp ---
105:
106: Warning: fopen(): remote host file access not supported, file://fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
107:
108: Warning: fopen(file://fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
109: --- WRITE: file://fopen14.tmpDir\fopen_variation14.tmp ---
110:
111: Warning: fopen(): remote host file access not supported, file://fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
112:
113: Warning: fopen(file://fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
114: --- READ: file://fopen14.tmpDir/fopen_variation14.tmp ---
115:
116: Warning: fopen(): remote host file access not supported, file://fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
117:
118: Warning: fopen(file://fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
119: --- WRITE: file://fopen14.tmpDir/fopen_variation14.tmp ---
120:
121: Warning: fopen(): remote host file access not supported, file://fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
122:
123: Warning: fopen(file://fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
124: --- READ: file://./fopen14.tmpDir/fopen_variation14.tmp ---
125:
126: Warning: fopen(): remote host file access not supported, file://./fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
127:
128: Warning: fopen(file://./fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
129: --- WRITE: file://./fopen14.tmpDir/fopen_variation14.tmp ---
130:
131: Warning: fopen(): remote host file access not supported, file://./fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
132:
133: Warning: fopen(file://./fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
134: --- READ: file://.\fopen14.tmpDir\fopen_variation14.tmp ---
135:
136: Warning: fopen(): remote host file access not supported, file://.\fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
137:
138: Warning: fopen(file://.\fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
139: --- WRITE: file://.\fopen14.tmpDir\fopen_variation14.tmp ---
140:
141: Warning: fopen(): remote host file access not supported, file://.\fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
142:
143: Warning: fopen(file://.\fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
144: --- READ: file://%s/fopen14.tmpDir/fopen_variation14.tmp ---
145: test passed
146: --- WRITE: file://%s/fopen14.tmpDir/fopen_variation14.tmp ---
147: test passed
148: --- READ: file://%s/fopen14.tmpDir\fopen_variation14.tmp ---
149: test passed
150: --- WRITE: file://%s/fopen14.tmpDir\fopen_variation14.tmp ---
151: test passed
152: --- READ: file:///%s/fopen14.tmpDir/fopen_variation14.tmp ---
153: test passed
154: --- WRITE: file:///%s/fopen14.tmpDir/fopen_variation14.tmp ---
155: test passed
156: --- READ: file://../fopen14.tmpDir/fopen_variation14.tmp ---
157:
158: Warning: fopen(): remote host file access not supported, file://../fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
159:
160: Warning: fopen(file://../fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
161: --- WRITE: file://../fopen14.tmpDir/fopen_variation14.tmp ---
162:
163: Warning: fopen(): remote host file access not supported, file://../fopen14.tmpDir/fopen_variation14.tmp in %s on line %d
164:
165: Warning: fopen(file://../fopen14.tmpDir/fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
166: --- READ: file://..\fopen14.tmpDir\fopen_variation14.tmp ---
167:
168: Warning: fopen(): remote host file access not supported, file://..\fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
169:
170: Warning: fopen(file://..\fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
171: --- WRITE: file://..\fopen14.tmpDir\fopen_variation14.tmp ---
172:
173: Warning: fopen(): remote host file access not supported, file://..\fopen14.tmpDir\fopen_variation14.tmp in %s on line %d
174:
175: Warning: fopen(file://..\fopen14.tmpDir\fopen_variation14.tmp): failed to open stream: no suitable wrapper could be found in %s on line %d
176: --- READ: file://%s/fopen14.tmpDir/fopen_variation14.tmp ---
177: test passed
178: --- WRITE: file://%s/fopen14.tmpDir/fopen_variation14.tmp ---
179: test passed
180: --- READ: file://%s/fopen14.tmpDir\fopen_variation14.tmp ---
181: test passed
182: --- WRITE: file://%s/fopen14.tmpDir\fopen_variation14.tmp ---
183: test passed
184: --- READ: file:///%s/fopen14.tmpDir/fopen_variation14.tmp ---
185: test passed
186: --- WRITE: file:///%s/fopen14.tmpDir/fopen_variation14.tmp ---
187: test passed
188: ===DONE===
189:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>