Annotation of embedaddon/php/ext/standard/tests/dir/chdir_basic.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test chdir() function : basic functionality
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : bool chdir(string $directory)
! 6: * Description: Change the current directory
! 7: * Source code: ext/standard/dir.c
! 8: */
! 9:
! 10: /*
! 11: * Test basic functionality of chdir() with absolute and relative paths
! 12: */
! 13:
! 14: echo "*** Testing chdir() : basic functionality ***\n";
! 15: $base_dir_path = dirname(__FILE__);
! 16:
! 17: $level_one_dir_name = "level_one";
! 18: $level_one_dir_path = "$base_dir_path/$level_one_dir_name";
! 19:
! 20: $level_two_dir_name = "level_two";
! 21: $level_two_dir_path = "$base_dir_path/$level_one_dir_name/$level_two_dir_name";
! 22:
! 23: // create directories
! 24: mkdir($level_one_dir_path);
! 25: mkdir($level_two_dir_path);
! 26:
! 27: echo "\n-- Testing chdir() with absolute path: --\n";
! 28: chdir($base_dir_path);
! 29: var_dump(chdir($level_one_dir_path));
! 30: var_dump(getcwd());
! 31:
! 32: echo "\n-- Testing chdir() with relative paths: --\n";
! 33: var_dump(chdir($level_two_dir_name));
! 34: var_dump(getcwd());
! 35: ?>
! 36: ===DONE===
! 37: --CLEAN--
! 38: <?php
! 39: $file_path = dirname(__FILE__);
! 40: rmdir("$file_path/level_one/level_two");
! 41: rmdir("$file_path/level_one");
! 42: ?>
! 43: --EXPECTF--
! 44: *** Testing chdir() : basic functionality ***
! 45:
! 46: -- Testing chdir() with absolute path: --
! 47: bool(true)
! 48: string(%d) "%slevel_one"
! 49:
! 50: -- Testing chdir() with relative paths: --
! 51: bool(true)
! 52: string(%d) "%slevel_one%elevel_two"
! 53: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>