fileperms_variation1.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --TEST--
  2. Test fileperms() 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. /* Creating soft and hard links to a file and applying fileperms() on links */
  13. $file_path = __DIR__;
  14. fclose( fopen($file_path."/fileperms_variation1.tmp", "w") );
  15. echo "*** Testing fileperms() with links ***\n";
  16. /* With symlink */
  17. symlink($file_path."/fileperms_variation1.tmp", $file_path."/fileperms_variation1_symlink.tmp");
  18. var_dump( fileperms($file_path."/fileperms_variation1_symlink.tmp") ); //expected true
  19. clearstatcache();
  20. /* With hardlink */
  21. link($file_path."/fileperms_variation1.tmp", $file_path."/fileperms_variation1_link.tmp");
  22. var_dump( fileperms($file_path."/fileperms_variation1_link.tmp") ); // expected: true
  23. clearstatcache();
  24. echo "\n*** Done ***";
  25. ?>
  26. --CLEAN--
  27. <?php
  28. $file_path = __DIR__;
  29. unlink($file_path."/fileperms_variation1_symlink.tmp");
  30. unlink($file_path."/fileperms_variation1_link.tmp");
  31. unlink($file_path."/fileperms_variation1.tmp");
  32. ?>
  33. --EXPECTF--
  34. *** Testing fileperms() with links ***
  35. int(%d)
  36. int(%d)
  37. *** Done ***