Return to fileowner_variation1.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / file |
1.1 misho 1: --TEST-- 2: Test fileowner() function: usage variations - links 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: int fileowner ( string $filename ) 13: * Description: Returns the user ID of the owner of the file, or 14: * FALSE in case of an error. 15: */ 16: 17: /* Creating soft and hard links to a file and applying fileowner() on links */ 18: 19: $file_path = dirname(__FILE__); 20: fclose( fopen($file_path."/fileowner_variation1.tmp", "w") ); 21: 22: echo "*** Testing fileowner() with links ***\n"; 23: /* With symlink */ 24: symlink($file_path."/fileowner_variation1.tmp", $file_path."/fileowner_variation1_symlink.tmp"); 25: var_dump( fileowner($file_path."/fileowner_variation1_symlink.tmp") ); //expected true 26: clearstatcache(); 27: 28: /* With hardlink */ 29: link($file_path."/fileowner_variation1.tmp", $file_path."/fileowner_variation1_link.tmp"); 30: var_dump( fileowner($file_path."/fileowner_variation1_link.tmp") ); // expected: true 31: clearstatcache(); 32: 33: echo "\n*** Done ***"; 34: ?> 35: --CLEAN-- 36: <?php 37: $file_path = dirname(__FILE__); 38: unlink($file_path."/fileowner_variation1_symlink.tmp"); 39: unlink($file_path."/fileowner_variation1_link.tmp"); 40: unlink($file_path."/fileowner_variation1.tmp"); 41: ?> 42: 43: --EXPECTF-- 44: *** Testing fileowner() with links *** 45: int(%d) 46: int(%d) 47: 48: *** Done ***