Annotation of embedaddon/php/ext/standard/tests/file/file_put_contents_variation4.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test file_put_contents() function : variation - include path testing
3: --CREDITS--
4: Dave Kelsey <d_kelsey@uk.ibm.com>
5: --FILE--
6: <?php
7: /* Prototype : int file_put_contents(string file, mixed data [, int flags [, resource context]])
8: * Description: Write/Create a file with contents data and return the number of bytes written
9: * Source code: ext/standard/file.c
10: * Alias to functions:
11: */
12:
13:
14: require_once('fopen_include_path.inc');
15:
16: $thisTestDir = basename(__FILE__, ".php") . ".dir";
17: mkdir($thisTestDir);
18: chdir($thisTestDir);
19:
20: $filename = basename(__FILE__, ".php") . ".tmp";
21:
22: $newpath = create_include_path();
23: set_include_path($newpath);
24: runtest();
25:
26: $newpath = generate_next_path();
27: set_include_path($newpath);
28: runtest();
29:
30: teardown_include_path();
31: restore_include_path();
32: chdir("..");
33: rmdir($thisTestDir);
34:
35:
36: function runtest() {
37: global $filename;
38: //correct php53 behaviour is to ingnore the FILE_USE_INCLUDE_PATH unless the file alread exists
39: // in the include path. In this case it doesn't so the file should be written in the current dir.
40: file_put_contents($filename, (binary) "File in include path", FILE_USE_INCLUDE_PATH);
41: $line = file_get_contents($filename);
42: echo "$line\n";
43: unlink($filename);
44: }
45:
46: ?>
47: ===DONE===
48: --EXPECT--
49: File in include path
50: File in include path
51: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>