Annotation of embedaddon/php/ext/standard/tests/file/mkdir_variation5-win32.phpt, revision 1.1
1.1 ! misho 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: /* Prototype : bool mkdir(string pathname [, int mode [, bool recursive [, resource context]]])
! 13: * Description: Create a directory
! 14: * Source code: ext/standard/file.c
! 15: * Alias to functions:
! 16: */
! 17:
! 18: echo "*** Testing mkdir() : variation ***\n";
! 19:
! 20: $workDir = "mkdirVar5.tmp";
! 21: $subDir = "aSubDir";
! 22: mkdir($workDir);
! 23: $cwd = getcwd();
! 24:
! 25: $unixifiedDir = '/'.substr(str_replace('\\','/',$cwd).'/'.$workDir.'/'.$subDir, 3);
! 26:
! 27: $dirs = array(
! 28: // relative
! 29: $workDir.'\\'.$subDir,
! 30: '.\\'.$workDir.'\\'.$subDir,
! 31: $workDir.'\\..\\'.$workDir.'\\'.$subDir,
! 32:
! 33: // relative bad path
! 34: $workDir.'\\..\\BADDIR\\'.$subDir,
! 35: 'BADDIR\\'.$subDir,
! 36:
! 37: //absolute
! 38: $cwd.'\\'.$workDir.'\\'.$subDir,
! 39: $cwd.'\\.\\'.$workDir.'\\'.$subDir,
! 40: $cwd.'\\'.$workDir.'\\..\\'.$workDir.'\\'.$subDir,
! 41:
! 42: //absolute bad path
! 43: $cwd.'\\BADDIR\\'.$subDir,
! 44:
! 45: //trailing separators
! 46: $workDir.'\\'.$subDir.'\\',
! 47: $cwd.'\\'.$workDir.'\\'.$subDir.'\\',
! 48:
! 49: // multiple separators
! 50: $workDir.'\\\\'.$subDir,
! 51: $cwd.'\\\\'.$workDir.'\\\\'.$subDir,
! 52:
! 53: // Unixified Dir
! 54: $unixifiedDir,
! 55:
! 56: );
! 57:
! 58:
! 59: foreach($dirs as $dir) {
! 60: echo "-- creating $dir --\n";
! 61: $res = mkdir($dir);
! 62: if ($res === true) {
! 63: echo "Directory created\n";
! 64: rmdir($workDir.'\\'.$subDir);
! 65: }
! 66: }
! 67:
! 68: rmdir($workDir);
! 69:
! 70: ?>
! 71: ===DONE===
! 72: --EXPECTF--
! 73: *** Testing mkdir() : variation ***
! 74: -- creating mkdirVar5.tmp\aSubDir --
! 75: Directory created
! 76: -- creating .\mkdirVar5.tmp\aSubDir --
! 77: Directory created
! 78: -- creating mkdirVar5.tmp\..\mkdirVar5.tmp\aSubDir --
! 79: Directory created
! 80: -- creating mkdirVar5.tmp\..\BADDIR\aSubDir --
! 81:
! 82: Warning: mkdir(): No such file or directory in %s on line %d
! 83: -- creating BADDIR\aSubDir --
! 84:
! 85: Warning: mkdir(): No such file or directory in %s on line %d
! 86: -- creating %s\mkdirVar5.tmp\aSubDir --
! 87: Directory created
! 88: -- creating %s\.\mkdirVar5.tmp\aSubDir --
! 89: Directory created
! 90: -- creating %s\mkdirVar5.tmp\..\mkdirVar5.tmp\aSubDir --
! 91: Directory created
! 92: -- creating %s\BADDIR\aSubDir --
! 93:
! 94: Warning: mkdir(): No such file or directory in %s on line %d
! 95: -- creating mkdirVar5.tmp\aSubDir\ --
! 96: Directory created
! 97: -- creating %s\mkdirVar5.tmp\aSubDir\ --
! 98: Directory created
! 99: -- creating mkdirVar5.tmp\\aSubDir --
! 100: Directory created
! 101: -- creating %s\\mkdirVar5.tmp\\aSubDir --
! 102: Directory created
! 103: -- creating /%s/mkdirVar5.tmp/aSubDir --
! 104: Directory created
! 105: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>