Annotation of embedaddon/php/ext/standard/tests/file/mkdir_variation5.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 Not 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: $dirs = array(
! 26: // relative
! 27: $workDir.'/'.$subDir,
! 28: './'.$workDir.'/'.$subDir,
! 29: $workDir.'/../'.$workDir.'/'.$subDir,
! 30:
! 31: // relative bad path
! 32: $workDir.'/../BADDIR/'.$subDir,
! 33: 'BADDIR/'.$subDir,
! 34:
! 35: //absolute
! 36: $cwd.'/'.$workDir.'/'.$subDir,
! 37: $cwd.'/./'.$workDir.'/'.$subDir,
! 38: $cwd.'/'.$workDir.'/../'.$workDir.'/'.$subDir,
! 39:
! 40: //absolute bad path
! 41: $cwd.'/BADDIR/'.$subDir,
! 42:
! 43: //trailing separators
! 44: $workDir.'/'.$subDir.'/',
! 45: $cwd.'/'.$workDir.'/'.$subDir.'/',
! 46:
! 47: // multiple separators
! 48: $workDir.'//'.$subDir,
! 49: $cwd.'//'.$workDir.'//'.$subDir,
! 50:
! 51: );
! 52:
! 53:
! 54: foreach($dirs as $dir) {
! 55: echo "-- creating $dir --\n";
! 56: $res = mkdir($dir);
! 57: if ($res === true) {
! 58: echo "Directory created\n";
! 59: rmdir($dir);
! 60: }
! 61: }
! 62:
! 63: rmdir($workDir);
! 64:
! 65: ?>
! 66: ===DONE===
! 67: --EXPECTF--
! 68: *** Testing mkdir() : variation ***
! 69: -- creating mkdirVar5.tmp/aSubDir --
! 70: Directory created
! 71: -- creating ./mkdirVar5.tmp/aSubDir --
! 72: Directory created
! 73: -- creating mkdirVar5.tmp/../mkdirVar5.tmp/aSubDir --
! 74: Directory created
! 75: -- creating mkdirVar5.tmp/../BADDIR/aSubDir --
! 76:
! 77: Warning: mkdir(): No such file or directory in %s on line %d
! 78: -- creating BADDIR/aSubDir --
! 79:
! 80: Warning: mkdir(): No such file or directory in %s on line %d
! 81: -- creating %s/mkdirVar5.tmp/aSubDir --
! 82: Directory created
! 83: -- creating %s/./mkdirVar5.tmp/aSubDir --
! 84: Directory created
! 85: -- creating %s/mkdirVar5.tmp/../mkdirVar5.tmp/aSubDir --
! 86: Directory created
! 87: -- creating %s/BADDIR/aSubDir --
! 88:
! 89: Warning: mkdir(): No such file or directory in %s on line %d
! 90: -- creating mkdirVar5.tmp/aSubDir/ --
! 91: Directory created
! 92: -- creating %s/mkdirVar5.tmp/aSubDir/ --
! 93: Directory created
! 94: -- creating mkdirVar5.tmp//aSubDir --
! 95: Directory created
! 96: -- creating %s//mkdirVar5.tmp//aSubDir --
! 97: Directory created
! 98: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>