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