Return to file_get_contents_variation9.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / file |
1.1 misho 1: --TEST-- 2: Test file_get_contents() function : variation - linked files 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 Do not run on Windows"); 9: ?> 10: --FILE-- 11: <?php 12: /* Prototype : string file_get_contents(string filename [, bool use_include_path [, resource context [, long offset [, long maxlen]]]]) 13: * Description: Read the entire file into a string 14: * Source code: ext/standard/file.c 15: * Alias to functions: 16: */ 17: 18: echo "*** Testing file_get_contents() : variation ***\n"; 19: $filename = dirname(__FILE__).'/fileGetContentsVar9.tmp'; 20: $softlink = dirname(__FILE__).'/fileGetContentsVar9.SoftLink'; 21: $hardlink = dirname(__FILE__).'/fileGetContentsVar9.HardLink'; 22: $chainlink = dirname(__FILE__).'/fileGetContentsVar9.ChainLink'; 23: 24: // create file 25: $h = fopen($filename,"w"); 26: //Data should be more than the size of a link. 27: for ($i = 1; $i <= 10; $i++) { 28: fwrite($h, b"Here is a repeated amount of data"); 29: } 30: fclose($h); 31: 32: // link files 33: link($filename, $hardlink); 34: symlink($filename, $softlink); 35: symlink($softlink, $chainlink); 36: 37: // perform tests 38: var_dump(file_get_contents($chainlink)); 39: var_dump(file_get_contents($softlink)); 40: var_dump(file_get_contents($hardlink)); 41: 42: unlink($chainlink); 43: unlink($softlink); 44: unlink($hardlink); 45: unlink($filename); 46: 47: echo "\n*** Done ***\n"; 48: ?> 49: --EXPECTF-- 50: *** Testing file_get_contents() : variation *** 51: string(330) "Here is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of data" 52: string(330) "Here is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of data" 53: string(330) "Here is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of dataHere is a repeated amount of data" 54: 55: *** Done *** 56: