readdir_basic-win32-mb.phpt 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. --TEST--
  2. Test readdir() function : basic functionality
  3. --SKIPIF--
  4. <?php
  5. if (substr(PHP_OS, 0, 3) != 'WIN') {
  6. die("skip Valid only on Windows");
  7. }
  8. ?>
  9. --FILE--
  10. <?php
  11. /*
  12. * Test basic functionality of readdir()
  13. */
  14. echo "*** Testing readdir() : basic functionality ***\n";
  15. // include the file.inc for Function: function create_files()
  16. chdir(__DIR__);
  17. include(__DIR__."/../file/file.inc");
  18. $path = __DIR__ . '/私はガラスを食べられますreaddir_basic';
  19. mkdir($path);
  20. create_files($path, 3);
  21. echo "\n-- Call readdir() with \$path argument --\n";
  22. var_dump($dh = opendir($path));
  23. $a = array();
  24. while( FALSE !== ($file = readdir($dh)) ) {
  25. $a[] = $file;
  26. }
  27. sort($a);
  28. foreach($a as $file) {
  29. var_dump($file);
  30. }
  31. echo "\n-- Call readdir() without \$path argument --\n";
  32. var_dump($dh = opendir($path));
  33. $a = array();
  34. while( FALSE !== ( $file = readdir() ) ) {
  35. $a[] = $file;
  36. }
  37. sort($a);
  38. foreach($a as $file) {
  39. var_dump($file);
  40. }
  41. delete_files($path, 3);
  42. closedir($dh);
  43. ?>
  44. --CLEAN--
  45. <?php
  46. $path = __DIR__ . '/私はガラスを食べられますreaddir_basic';
  47. rmdir($path);
  48. ?>
  49. --EXPECTF--
  50. *** Testing readdir() : basic functionality ***
  51. -- Call readdir() with $path argument --
  52. resource(%d) of type (stream)
  53. string(1) "."
  54. string(2) ".."
  55. string(9) "file1.tmp"
  56. string(9) "file2.tmp"
  57. string(9) "file3.tmp"
  58. -- Call readdir() without $path argument --
  59. resource(%d) of type (stream)
  60. string(1) "."
  61. string(2) ".."
  62. string(9) "file1.tmp"
  63. string(9) "file2.tmp"
  64. string(9) "file3.tmp"