opendir_basic-win32-mb.phpt 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. --TEST--
  2. Test opendir() 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 opendir() with absolute and relative paths as $path argument
  13. */
  14. echo "*** Testing opendir() : basic functionality ***\n";
  15. $base_dir_path = __DIR__ . '/opendir_basic-win32-mb';
  16. @mkdir($base_dir_path);
  17. $level_one_dir_name = "私はガラスを食べられますlevel_one";
  18. $level_one_dir_path = "$base_dir_path/$level_one_dir_name";
  19. $level_two_dir_name = "私はガラスを食べられますlevel_two";
  20. $level_two_dir_path = "$base_dir_path/$level_one_dir_name/$level_two_dir_name";
  21. // create temporary directories - will remove in CLEAN section
  22. mkdir($level_one_dir_path);
  23. mkdir($level_two_dir_path);
  24. echo "\n-- Testing opendir() with absolute path: --\n";
  25. var_dump($dh1 = opendir($level_one_dir_path));
  26. echo "\n-- Testing opendir() with relative paths: --\n";
  27. var_dump(chdir($level_one_dir_path));
  28. var_dump($dh2 = opendir($level_two_dir_name));
  29. echo "\n-- Close directory handles: --\n";
  30. closedir($dh1);
  31. var_dump($dh1);
  32. closedir($dh2);
  33. var_dump($dh2);
  34. ?>
  35. --CLEAN--
  36. <?php
  37. $base_dir_path = __DIR__ . '/opendir_basic-win32-mb';
  38. rmdir("$base_dir_path/私はガラスを食べられますlevel_one/私はガラスを食べられますlevel_two");
  39. rmdir("$base_dir_path/私はガラスを食べられますlevel_one");
  40. rmdir($base_dir_path);
  41. ?>
  42. --EXPECTF--
  43. *** Testing opendir() : basic functionality ***
  44. -- Testing opendir() with absolute path: --
  45. resource(%d) of type (stream)
  46. -- Testing opendir() with relative paths: --
  47. bool(true)
  48. resource(%d) of type (stream)
  49. -- Close directory handles: --
  50. resource(%d) of type (Unknown)
  51. resource(%d) of type (Unknown)