readdir_variation6-win32-mb.phpt 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. --TEST--
  2. Test readdir() function : usage variations - operate on previously opened directory
  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. * Open two directory handles on the same directory and pass both
  13. * to readdir() to test behaviour
  14. */
  15. echo "*** Testing readdir() : usage variations ***\n";
  16. // include the file.inc for Function: function create_files()
  17. include( __DIR__."/../file/file.inc");
  18. // create the temporary directory
  19. $dir_path = __DIR__ . "/私はガラスを食べられますreaddir_variation6";
  20. mkdir($dir_path);
  21. // create files within the temporary directory
  22. create_files($dir_path, 3, "alphanumeric", 0755, 1, "w", "私はガラスを食べられますreaddir_variation6");
  23. // open the directory
  24. $dir_handle1 = opendir($dir_path);
  25. // open the same directory again without closing it
  26. opendir($dir_path);
  27. echo "\n-- Reading Directory Contents with Previous Handle --\n";
  28. $a = array();
  29. while (FALSE !== ($file = readdir($dir_handle1))) {
  30. $a[] = $file;
  31. }
  32. sort($a);
  33. foreach ($a as $file) {
  34. var_dump($file);
  35. }
  36. echo "\n-- Reading Directory Contents with Current Handle (no arguments supplied) --\n";
  37. $a = array();
  38. while (FALSE !== ($file = readdir())) {
  39. $a[] = $file;
  40. }
  41. sort($a);
  42. foreach ($a as $file) {
  43. var_dump($file);
  44. }
  45. // delete temporary files
  46. delete_files($dir_path, 3, "私はガラスを食べられますreaddir_variation6");
  47. closedir($dir_handle1);
  48. closedir();
  49. ?>
  50. --CLEAN--
  51. <?php
  52. $dir_path = __DIR__ . "/私はガラスを食べられますreaddir_variation6";
  53. rmdir($dir_path);
  54. ?>
  55. --EXPECT--
  56. *** Testing readdir() : usage variations ***
  57. -- Reading Directory Contents with Previous Handle --
  58. string(1) "."
  59. string(2) ".."
  60. string(59) "私はガラスを食べられますreaddir_variation61.tmp"
  61. string(59) "私はガラスを食べられますreaddir_variation62.tmp"
  62. string(59) "私はガラスを食べられますreaddir_variation63.tmp"
  63. -- Reading Directory Contents with Current Handle (no arguments supplied) --
  64. string(1) "."
  65. string(2) ".."
  66. string(59) "私はガラスを食べられますreaddir_variation61.tmp"
  67. string(59) "私はガラスを食べられますreaddir_variation62.tmp"
  68. string(59) "私はガラスを食べられますreaddir_variation63.tmp"