Return to copy_basic.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / file |
1.1 misho 1: --TEST-- 2: Test copy() function: basic functionality 3: --FILE-- 4: <?php 5: /* Prototype: bool copy ( string $source, string $dest ); 6: * Description: Makes a copy of the file source to dest. 7: * Returns TRUE on success or FALSE on failure. 8: */ 9: 10: echo "*** Testing copy() function: to copy file from source to destination --\n"; 11: 12: var_dump( file_exists(__FILE__) ); 13: 14: /* copying the file */ 15: $file_path = dirname(__FILE__); 16: $file_name1 = $file_path."/copy_basic1.tmp"; 17: $file_name2 = $file_path."/copy_basic2.tmp"; 18: var_dump( copy(__FILE__, $file_name1) ); 19: var_dump( copy($file_name1, $file_name2) ); 20: 21: echo "-- Checking whether the copy of file exists --\n"; 22: var_dump( file_exists($file_name1) ); 23: var_dump( file_exists($file_name2) ); 24: 25: echo "-- Checking filepermissions of file and its copies --\n"; 26: printf( "%o", fileperms(__FILE__) ); 27: echo "\n"; 28: printf( "%o", fileperms($file_name1) ); 29: echo "\n"; 30: printf( "%o", fileperms($file_name2) ); 31: echo "\n"; 32: 33: echo "*** Done ***\n"; 34: ?> 35: 36: --CLEAN-- 37: <?php 38: $file_path = dirname(__FILE__); 39: $file_name1 = $file_path."/copy_basic1.tmp"; 40: $file_name2 = $file_path."/copy_basic2.tmp"; 41: unlink($file_name1); 42: unlink($file_name2); 43: ?> 44: 45: --EXPECTF-- 46: *** Testing copy() function: to copy file from source to destination -- 47: bool(true) 48: bool(true) 49: bool(true) 50: -- Checking whether the copy of file exists -- 51: bool(true) 52: bool(true) 53: -- Checking filepermissions of file and its copies -- 54: %d 55: %d 56: %d 57: *** Done *** 58: