1--TEST-- 2Test opendir() 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 : mixed opendir(string $path[, resource $context]) 12 * Description: Open a directory and return a dir_handle 13 * Source code: ext/standard/dir.c 14 */ 15 16/* 17 * Test basic functionality of opendir() with absolute and relative paths as $path argument 18 */ 19 20echo "*** Testing opendir() : basic functionality ***\n"; 21 22$base_dir_path = __DIR__ . '/opendir_basic-win32-mb'; 23@mkdir($base_dir_path); 24 25$level_one_dir_name = "私はガラスを食べられますlevel_one"; 26$level_one_dir_path = "$base_dir_path/$level_one_dir_name"; 27 28$level_two_dir_name = "私はガラスを食べられますlevel_two"; 29$level_two_dir_path = "$base_dir_path/$level_one_dir_name/$level_two_dir_name"; 30 31// create temporary directories - will remove in CLEAN section 32mkdir($level_one_dir_path); 33mkdir($level_two_dir_path); 34 35echo "\n-- Testing opendir() with absolute path: --\n"; 36var_dump($dh1 = opendir($level_one_dir_path)); 37 38 39echo "\n-- Testing opendir() with relative paths: --\n"; 40var_dump(chdir($level_one_dir_path)); 41var_dump($dh2 = opendir($level_two_dir_name)); 42 43echo "\n-- Close directory handles: --\n"; 44closedir($dh1); 45var_dump($dh1); 46closedir($dh2); 47var_dump($dh2); 48?> 49===DONE=== 50--CLEAN-- 51<?php 52$base_dir_path = __DIR__ . '/opendir_basic-win32-mb'; 53rmdir("$base_dir_path/私はガラスを食べられますlevel_one/私はガラスを食べられますlevel_two"); 54rmdir("$base_dir_path/私はガラスを食べられますlevel_one"); 55rmdir($base_dir_path); 56?> 57--EXPECTF-- 58*** Testing opendir() : basic functionality *** 59 60-- Testing opendir() with absolute path: -- 61resource(%d) of type (stream) 62 63-- Testing opendir() with relative paths: -- 64bool(true) 65resource(%d) of type (stream) 66 67-- Close directory handles: -- 68resource(%d) of type (Unknown) 69resource(%d) of type (Unknown) 70===DONE=== 71