readdir_variation3-win32-mb.phpt 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. --TEST--
  2. Test readdir() function : usage variations - sub-directories
  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. * Pass a directory handle pointing to a directory that has a sub-directory
  13. * to test behaviour of readdir()
  14. */
  15. echo "*** Testing readdir() : usage variations ***\n";
  16. // include the file.inc for Function: function create_files()
  17. chdir(__DIR__);
  18. include(__DIR__."/../file/file.inc");
  19. $path_top = __DIR__ . '/readdir_variation3-win32-mb';
  20. $path_sub = $path_top . '/私はガラスを食べられますsub_folder';
  21. mkdir($path_top);
  22. mkdir($path_sub);
  23. create_files($path_top, 2);
  24. create_files($path_sub, 2);
  25. $dir_handle = opendir($path_top);
  26. while(FALSE !== ($file = readdir($dir_handle))) {
  27. // different OS order files differently so will
  28. // store file names into an array so can use sorted in expected output
  29. $contents[] = $file;
  30. }
  31. // more important to check that all contents are present than order they are returned in
  32. sort($contents);
  33. var_dump($contents);
  34. delete_files($path_top, 2);
  35. delete_files($path_sub, 2);
  36. closedir($dir_handle);
  37. ?>
  38. --CLEAN--
  39. <?php
  40. $path_top = __DIR__ . '/readdir_variation3-win32-mb';
  41. $path_sub = $path_top . '/私はガラスを食べられますsub_folder';
  42. rmdir($path_sub);
  43. rmdir($path_top);
  44. ?>
  45. --EXPECT--
  46. *** Testing readdir() : usage variations ***
  47. array(5) {
  48. [0]=>
  49. string(1) "."
  50. [1]=>
  51. string(2) ".."
  52. [2]=>
  53. string(9) "file1.tmp"
  54. [3]=>
  55. string(9) "file2.tmp"
  56. [4]=>
  57. string(46) "私はガラスを食べられますsub_folder"
  58. }