lchown_basic.phpt 900 B

123456789101112131415161718192021222324252627282930313233343536
  1. --TEST--
  2. Test lchown() function : basic functionality
  3. --SKIPIF--
  4. <?php
  5. if (substr(PHP_OS, 0, 3) == 'WIN') die('skip no windows support');
  6. if (!function_exists("posix_getuid")) die("skip no posix_getuid()");
  7. ?>
  8. --FILE--
  9. <?php
  10. echo "*** Testing lchown() : basic functionality ***\n";
  11. $filename = __DIR__ . DIRECTORY_SEPARATOR . 'lchown_basic.txt';
  12. $symlink = __DIR__ . DIRECTORY_SEPARATOR . 'lchown_basic_symlink.txt';
  13. $uid = posix_getuid();
  14. var_dump( touch( $filename ) );
  15. var_dump( symlink( $filename, $symlink ) );
  16. var_dump( lchown( $filename, $uid ) );
  17. var_dump( fileowner( $symlink ) === $uid );
  18. ?>
  19. --CLEAN--
  20. <?php
  21. $filename = __DIR__ . DIRECTORY_SEPARATOR . 'lchown_basic.txt';
  22. $symlink = __DIR__ . DIRECTORY_SEPARATOR . 'lchown_basic_symlink.txt';
  23. unlink($filename);
  24. unlink($symlink);
  25. ?>
  26. --EXPECT--
  27. *** Testing lchown() : basic functionality ***
  28. bool(true)
  29. bool(true)
  30. bool(true)
  31. bool(true)