fileowner_basic.phpt 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. --TEST--
  2. Test fileowner() function: basic functionality
  3. --FILE--
  4. <?php
  5. /* Prototype: int fileowner ( string $filename )
  6. * Description: Returns the user ID of the owner of the file, or
  7. * FALSE in case of an error.
  8. */
  9. echo "*** Testing fileowner(): basic functionality ***\n";
  10. echo "-- Testing with the file or directory created by owner --\n";
  11. var_dump( fileowner(__FILE__) );
  12. var_dump( fileowner(".") );
  13. var_dump( fileowner("./..") );
  14. /* Newly created files and dirs */
  15. $file_path = dirname(__FILE__);
  16. $file_name = $file_path."/fileowner_basic.tmp";
  17. $file_handle = fopen($file_name, "w");
  18. $string = "Hello, world\n1234\n123Hello";
  19. fwrite($file_handle, $string);
  20. var_dump( fileowner($file_name) );
  21. fclose($file_handle);
  22. $dir_name = $file_path."/fileowner_basic";
  23. mkdir($dir_name);
  24. var_dump( fileowner($dir_name) );
  25. echo "*** Done ***\n";
  26. ?>
  27. --CLEAN--
  28. <?php
  29. $file_path = dirname(__FILE__);
  30. $file_name = $file_path."/fileowner_basic.tmp";
  31. $dir_name = $file_path."/fileowner_basic";
  32. unlink($file_name);
  33. rmdir($dir_name);
  34. ?>
  35. --EXPECTF--
  36. *** Testing fileowner(): basic functionality ***
  37. -- Testing with the file or directory created by owner --
  38. int(%d)
  39. int(%d)
  40. int(%d)
  41. int(%d)
  42. int(%d)
  43. *** Done ***