chdir_basic-win32-mb.phpt 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. --TEST--
  2. Test chdir() 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 chdir() with absolute and relative paths
  13. */
  14. echo "*** Testing chdir() : basic functionality ***\n";
  15. $base_dir_path = __DIR__ . '/chdir_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 directories
  22. mkdir($level_one_dir_path);
  23. mkdir($level_two_dir_path);
  24. echo "\n-- Testing chdir() with absolute path: --\n";
  25. chdir($base_dir_path);
  26. var_dump(chdir($level_one_dir_path));
  27. var_dump(getcwd());
  28. echo "\n-- Testing chdir() with relative paths: --\n";
  29. var_dump(chdir($level_two_dir_name));
  30. var_dump(getcwd());
  31. ?>
  32. --CLEAN--
  33. <?php
  34. $base_dir_path = __DIR__ . '/chdir_basic-win32-mb';
  35. chdir(__DIR__);
  36. rmdir("$base_dir_path/私はガラスを食べられますlevel_one/私はガラスを食べられますlevel_two");
  37. rmdir("$base_dir_path/私はガラスを食べられますlevel_one");
  38. rmdir($base_dir_path);
  39. ?>
  40. --EXPECTF--
  41. *** Testing chdir() : basic functionality ***
  42. -- Testing chdir() with absolute path: --
  43. bool(true)
  44. string(%d) "%s私はガラスを食べられますlevel_one"
  45. -- Testing chdir() with relative paths: --
  46. bool(true)
  47. string(%d) "%s私はガラスを食べられますlevel_one%e私はガラスを食べられますlevel_two"