Annotation of embedaddon/php/ext/standard/tests/file/file_get_contents_variation2.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test file_get_contents() function : variation - include path testing
3: --CREDITS--
4: Dave Kelsey <d_kelsey@uk.ibm.com>
5: --FILE--
6: <?php
7: /* Prototype : string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]])
8: * Description: Read the entire file into a string
9: * Source code: ext/standard/file.c
10: * Alias to functions:
11: */
12:
13: echo "*** Testing file_get_contents() : variation ***\n";
14:
15:
16: require_once('fopen_include_path.inc');
17:
18: // this doesn't create the include dirs in this directory
19: // we change to this to ensure we are not part of the
20: // include paths.
21: $thisTestDir = "FileGetContentsVar2.dir";
22: mkdir($thisTestDir);
23: chdir($thisTestDir);
24:
25: $filename = 'FileGetContentsVar2.tmp';
26: $scriptLocFile = dirname(__FILE__)."/".$filename;
27:
28: $newpath = create_include_path();
29: set_include_path($newpath);
30: runtest();
31: teardown_include_path();
32: restore_include_path();
33: chdir("..");
34: rmdir($thisTestDir);
35:
36:
37: function runtest() {
38: global $scriptLocFile, $filename;
39: $h = fopen($scriptLocFile, "w");
40: fwrite($h, "File in script location");
41: fclose($h);
42: $line = file_get_contents($filename, true);
43: echo "$line\n";
44: unlink($scriptLocFile);
45: }
46:
47: ?>
48: ===DONE===
49: --EXPECT--
50: *** Testing file_get_contents() : variation ***
51: File in script location
52: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>