mkdir_variation5-win32.phpt 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. --TEST--
  2. Test mkdir() function : variation: various valid and invalid paths
  3. --CREDITS--
  4. Dave Kelsey <d_kelsey@uk.ibm.com>
  5. --SKIPIF--
  6. <?php
  7. if(substr(PHP_OS, 0, 3) != "WIN")
  8. die("skip Only valid for Windows");
  9. ?>
  10. --FILE--
  11. <?php
  12. echo "*** Testing mkdir() : variation ***\n";
  13. $workDir = "mkdirVar5.tmp";
  14. $subDir = "aSubDir";
  15. mkdir($workDir);
  16. $cwd = getcwd();
  17. $unixifiedDir = '/'.substr(str_replace('\\','/',$cwd).'/'.$workDir.'/'.$subDir, 3);
  18. $dirs = array(
  19. // relative
  20. $workDir.'\\'.$subDir,
  21. '.\\'.$workDir.'\\'.$subDir,
  22. $workDir.'\\..\\'.$workDir.'\\'.$subDir,
  23. // relative bad path
  24. $workDir.'\\..\\BADDIR\\'.$subDir,
  25. 'BADDIR\\'.$subDir,
  26. //absolute
  27. $cwd.'\\'.$workDir.'\\'.$subDir,
  28. $cwd.'\\.\\'.$workDir.'\\'.$subDir,
  29. $cwd.'\\'.$workDir.'\\..\\'.$workDir.'\\'.$subDir,
  30. //absolute bad path
  31. $cwd.'\\BADDIR\\'.$subDir,
  32. //trailing separators
  33. $workDir.'\\'.$subDir.'\\',
  34. $cwd.'\\'.$workDir.'\\'.$subDir.'\\',
  35. // multiple separators
  36. $workDir.'\\\\'.$subDir,
  37. $cwd.'\\\\'.$workDir.'\\\\'.$subDir,
  38. // Unixified Dir
  39. $unixifiedDir,
  40. );
  41. foreach($dirs as $dir) {
  42. echo "-- creating $dir --\n";
  43. $res = mkdir($dir);
  44. if ($res === true) {
  45. echo "Directory created\n";
  46. rmdir($workDir.'\\'.$subDir);
  47. }
  48. }
  49. rmdir($workDir);
  50. ?>
  51. --EXPECTF--
  52. *** Testing mkdir() : variation ***
  53. -- creating mkdirVar5.tmp\aSubDir --
  54. Directory created
  55. -- creating .\mkdirVar5.tmp\aSubDir --
  56. Directory created
  57. -- creating mkdirVar5.tmp\..\mkdirVar5.tmp\aSubDir --
  58. Directory created
  59. -- creating mkdirVar5.tmp\..\BADDIR\aSubDir --
  60. Warning: mkdir(): No such file or directory in %s on line %d
  61. -- creating BADDIR\aSubDir --
  62. Warning: mkdir(): No such file or directory in %s on line %d
  63. -- creating %s\mkdirVar5.tmp\aSubDir --
  64. Directory created
  65. -- creating %s\.\mkdirVar5.tmp\aSubDir --
  66. Directory created
  67. -- creating %s\mkdirVar5.tmp\..\mkdirVar5.tmp\aSubDir --
  68. Directory created
  69. -- creating %s\BADDIR\aSubDir --
  70. Warning: mkdir(): No such file or directory in %s on line %d
  71. -- creating mkdirVar5.tmp\aSubDir\ --
  72. Directory created
  73. -- creating %s\mkdirVar5.tmp\aSubDir\ --
  74. Directory created
  75. -- creating mkdirVar5.tmp\\aSubDir --
  76. Directory created
  77. -- creating %s\\mkdirVar5.tmp\\aSubDir --
  78. Directory created
  79. -- creating /%s/mkdirVar5.tmp/aSubDir --
  80. Directory created