glob_variation2.phpt 898 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. --TEST--
  2. Test glob() function with relative path
  3. --FILE--
  4. <?php
  5. $file_path = __DIR__;
  6. // temp dirname used here
  7. $dir_name = 'glob_test';
  8. // create temp directory
  9. mkdir("$file_path/$dir_name");
  10. // create temp file
  11. $fp = fopen("$file_path/$dir_name/file.text", "w");
  12. fclose($fp);
  13. echo "Testing glob() with relative paths:\n";
  14. chdir("$file_path/$dir_name");
  15. var_dump( glob("./*") );
  16. var_dump( glob("../$dir_name/*"));
  17. chdir("$file_path");
  18. var_dump( glob("$dir_name/*"));
  19. var_dump( glob("$dir_name"));
  20. echo "Done\n";
  21. ?>
  22. --CLEAN--
  23. <?php
  24. $file_path = __DIR__;
  25. unlink("$file_path/glob_test/file.text");
  26. rmdir("$file_path/glob_test/");
  27. ?>
  28. --EXPECT--
  29. Testing glob() with relative paths:
  30. array(1) {
  31. [0]=>
  32. string(11) "./file.text"
  33. }
  34. array(1) {
  35. [0]=>
  36. string(22) "../glob_test/file.text"
  37. }
  38. array(1) {
  39. [0]=>
  40. string(19) "glob_test/file.text"
  41. }
  42. array(1) {
  43. [0]=>
  44. string(9) "glob_test"
  45. }
  46. Done