1--TEST-- 2Test chdir() function : basic functionality 3--SKIPIF-- 4<?php 5if (substr(PHP_OS, 0, 3) != 'WIN') { 6 die("skip Valid only on Windows"); 7} 8?> 9--FILE-- 10<?php 11/* Prototype : bool chdir(string $directory) 12 * Description: Change the current directory 13 * Source code: ext/standard/dir.c 14 */ 15 16/* 17 * Test basic functionality of chdir() with absolute and relative paths 18 */ 19 20echo "*** Testing chdir() : basic functionality ***\n"; 21$base_dir_path = dirname(__FILE__); 22 23$level_one_dir_name = "私はガラスを食べられますlevel_one"; 24$level_one_dir_path = "$base_dir_path/$level_one_dir_name"; 25 26$level_two_dir_name = "私はガラスを食べられますlevel_two"; 27$level_two_dir_path = "$base_dir_path/$level_one_dir_name/$level_two_dir_name"; 28 29// create directories 30mkdir($level_one_dir_path); 31mkdir($level_two_dir_path); 32 33echo "\n-- Testing chdir() with absolute path: --\n"; 34chdir($base_dir_path); 35var_dump(chdir($level_one_dir_path)); 36var_dump(getcwd()); 37 38echo "\n-- Testing chdir() with relative paths: --\n"; 39var_dump(chdir($level_two_dir_name)); 40var_dump(getcwd()); 41?> 42===DONE=== 43--CLEAN-- 44<?php 45$file_path = dirname(__FILE__); 46chdir($file_path); 47rmdir("$file_path/私はガラスを食べられますlevel_one/私はガラスを食べられますlevel_two"); 48rmdir("$file_path/私はガラスを食べられますlevel_one"); 49?> 50--EXPECTF-- 51*** Testing chdir() : basic functionality *** 52 53-- Testing chdir() with absolute path: -- 54bool(true) 55string(%d) "%s私はガラスを食べられますlevel_one" 56 57-- Testing chdir() with relative paths: -- 58bool(true) 59string(%d) "%s私はガラスを食べられますlevel_one%e私はガラスを食べられますlevel_two" 60===DONE=== 61