dir_variation4-win32-mb.phpt 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. --TEST--
  2. Test dir() 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. * Testing the behavior of dir() function by trying to open a
  13. * directory which is already open.
  14. */
  15. echo "*** Testing dir() : operate on previously opened directory ***\n";
  16. // include the file.inc for Function: function create_files()
  17. include( __DIR__."/../file/file.inc");
  18. // create the temporary directory
  19. $file_path = __DIR__;
  20. $dir_path = $file_path."/私はガラスを食べられますdir_variation4";
  21. @mkdir($dir_path);
  22. // create files within the temporary directory
  23. create_files($dir_path, 3, "alphanumeric", 0755, 1, "w", "私はガラスを食べられますdir_variation4");
  24. // open the directory
  25. $d = dir($dir_path);
  26. var_dump( $d );
  27. // open the same directory again without closing it
  28. $e = dir($dir_path);
  29. var_dump( $e );
  30. echo "-- reading directory contents with previous handle --\n";
  31. var_dump( $d->read() ); // with previous handle
  32. echo "-- reading directory contents with current handle --\n";
  33. var_dump( $e->read() ); // with current handle
  34. // delete temporary files
  35. delete_files($dir_path, 3, "私はガラスを食べられますdir_variation4");
  36. echo "Done";
  37. ?>
  38. --CLEAN--
  39. <?php
  40. $file_path = __DIR__;
  41. $dir_path = $file_path."/私はガラスを食べられますdir_variation4";
  42. rmdir($dir_path);
  43. ?>
  44. --EXPECTF--
  45. *** Testing dir() : operate on previously opened directory ***
  46. object(Directory)#%d (2) {
  47. ["path"]=>
  48. string(%d) "%s/私はガラスを食べられますdir_variation4"
  49. ["handle"]=>
  50. resource(%d) of type (stream)
  51. }
  52. object(Directory)#%d (2) {
  53. ["path"]=>
  54. string(%d) "%s/私はガラスを食べられますdir_variation4"
  55. ["handle"]=>
  56. resource(%d) of type (stream)
  57. }
  58. -- reading directory contents with previous handle --
  59. string(%d) "%s"
  60. -- reading directory contents with current handle --
  61. string(%d) "%s"
  62. Done