Annotation of embedaddon/php/ext/standard/tests/file/file_get_contents_variation1.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: require_once('fopen_include_path.inc');
                     16: 
                     17: // this doesn't create the include dirs in this directory
                     18: // we change to this to ensure we are not part of the
                     19: // include paths.
                     20: $thisTestDir = "fileGetContentsVar1.dir";
                     21: mkdir($thisTestDir);
                     22: chdir($thisTestDir);
                     23: 
                     24: $filename = "afile.txt";
                     25: $secondFile = $dir2."/".$filename;
                     26: 
                     27: $newpath = create_include_path();
                     28: set_include_path($newpath);
                     29: runtest();
                     30: teardown_include_path();
                     31: restore_include_path();
                     32: chdir("..");
                     33: rmdir($thisTestDir);
                     34: 
                     35: 
                     36: function runtest() {
                     37:    global $secondFile, $filename;
                     38:    $h = fopen($secondFile, "w");
                     39:    fwrite($h, "File in include path");
                     40:    fclose($h);
                     41:    $line = file_get_contents($filename, true);
                     42:    echo "$line\n";
                     43:    unlink($secondFile);  
                     44: }
                     45: 
                     46: ?>
                     47: ===DONE===
                     48: --EXPECT--
                     49: *** Testing file_get_contents() : variation ***
                     50: File in include path
                     51: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>