12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- --TEST--
- Test mkdir() function : variation: various valid and invalid paths
- --CREDITS--
- Dave Kelsey <d_kelsey@uk.ibm.com>
- --SKIPIF--
- <?php
- if(substr(PHP_OS, 0, 3) != "WIN")
- die("skip Only valid for Windows");
- ?>
- --FILE--
- <?php
- echo "*** Testing mkdir() : variation ***\n";
- $workDir = "mkdirVar5.tmp";
- $subDir = "aSubDir";
- mkdir($workDir);
- $cwd = getcwd();
- $unixifiedDir = '/'.substr(str_replace('\\','/',$cwd).'/'.$workDir.'/'.$subDir, 3);
- $dirs = array(
- // relative
- $workDir.'\\'.$subDir,
- '.\\'.$workDir.'\\'.$subDir,
- $workDir.'\\..\\'.$workDir.'\\'.$subDir,
- // relative bad path
- $workDir.'\\..\\BADDIR\\'.$subDir,
- 'BADDIR\\'.$subDir,
- //absolute
- $cwd.'\\'.$workDir.'\\'.$subDir,
- $cwd.'\\.\\'.$workDir.'\\'.$subDir,
- $cwd.'\\'.$workDir.'\\..\\'.$workDir.'\\'.$subDir,
- //absolute bad path
- $cwd.'\\BADDIR\\'.$subDir,
- //trailing separators
- $workDir.'\\'.$subDir.'\\',
- $cwd.'\\'.$workDir.'\\'.$subDir.'\\',
- // multiple separators
- $workDir.'\\\\'.$subDir,
- $cwd.'\\\\'.$workDir.'\\\\'.$subDir,
- // Unixified Dir
- $unixifiedDir,
- );
- foreach($dirs as $dir) {
- echo "-- creating $dir --\n";
- $res = mkdir($dir);
- if ($res === true) {
- echo "Directory created\n";
- rmdir($workDir.'\\'.$subDir);
- }
- }
- rmdir($workDir);
- ?>
- --EXPECTF--
- *** Testing mkdir() : variation ***
- -- creating mkdirVar5.tmp\aSubDir --
- Directory created
- -- creating .\mkdirVar5.tmp\aSubDir --
- Directory created
- -- creating mkdirVar5.tmp\..\mkdirVar5.tmp\aSubDir --
- Directory created
- -- creating mkdirVar5.tmp\..\BADDIR\aSubDir --
- Warning: mkdir(): No such file or directory in %s on line %d
- -- creating BADDIR\aSubDir --
- Warning: mkdir(): No such file or directory in %s on line %d
- -- creating %s\mkdirVar5.tmp\aSubDir --
- Directory created
- -- creating %s\.\mkdirVar5.tmp\aSubDir --
- Directory created
- -- creating %s\mkdirVar5.tmp\..\mkdirVar5.tmp\aSubDir --
- Directory created
- -- creating %s\BADDIR\aSubDir --
- Warning: mkdir(): No such file or directory in %s on line %d
- -- creating mkdirVar5.tmp\aSubDir\ --
- Directory created
- -- creating %s\mkdirVar5.tmp\aSubDir\ --
- Directory created
- -- creating mkdirVar5.tmp\\aSubDir --
- Directory created
- -- creating %s\\mkdirVar5.tmp\\aSubDir --
- Directory created
- -- creating /%s/mkdirVar5.tmp/aSubDir --
- Directory created
|