fileinode_variation1.phpt 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. --TEST--
  2. Test fileinode() 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. /*
  13. Prototype: int fileinode ( string $filename );
  14. Description: Returns the inode number of the file, or FALSE in case of an error.
  15. */
  16. /* Creating soft and hard links to a file and applying fileinode() on links */
  17. $file_path = dirname(__FILE__);
  18. fclose( fopen($file_path."/fileinode_variation1.tmp", "w") );
  19. echo "*** Testing fileinode() with links ***\n";
  20. /* With symlink */
  21. symlink($file_path."/fileinode_variation1.tmp", $file_path."/fileinode_variation1_symlink.tmp");
  22. var_dump( fileinode($file_path."/fileinode_variation1_symlink.tmp") ); //expected true
  23. clearstatcache();
  24. /* With hardlink */
  25. link($file_path."/fileinode_variation1.tmp", $file_path."/fileinode_variation1_link.tmp");
  26. var_dump( fileinode($file_path."/fileinode_variation1_link.tmp") ); // expected: true
  27. clearstatcache();
  28. echo "\n*** Done ***";
  29. ?>
  30. --CLEAN--
  31. <?php
  32. $file_path = dirname(__FILE__);
  33. unlink($file_path."/fileinode_variation1_symlink.tmp");
  34. unlink($file_path."/fileinode_variation1_link.tmp");
  35. unlink($file_path."/fileinode_variation1.tmp");
  36. ?>
  37. --EXPECTF--
  38. *** Testing fileinode() with links ***
  39. int(%d)
  40. int(%d)
  41. *** Done ***