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 = dirname(__FILE__);
23
24$level_one_dir_name = "私はガラスを食べられますlevel_one";
25$level_one_dir_path = "$base_dir_path/$level_one_dir_name";
26
27$level_two_dir_name = "私はガラスを食べられますlevel_two";
28$level_two_dir_path = "$base_dir_path/$level_one_dir_name/$level_two_dir_name";
29
30// create temporary directories - will remove in CLEAN section
31mkdir($level_one_dir_path);
32mkdir($level_two_dir_path);
33
34echo "\n-- Testing opendir() with absolute path: --\n";
35var_dump($dh1 = opendir($level_one_dir_path));
36
37
38echo "\n-- Testing opendir() with relative paths: --\n";
39var_dump(chdir($level_one_dir_path));
40var_dump($dh2 = opendir($level_two_dir_name));
41
42echo "\n-- Close directory handles: --\n";
43closedir($dh1);
44var_dump($dh1);
45closedir($dh2);
46var_dump($dh2);
47?>
48===DONE===
49--CLEAN--
50<?php
51$file_path = dirname(__FILE__);
52rmdir("$file_path/私はガラスを食べられますlevel_one/私はガラスを食べられますlevel_two");
53rmdir("$file_path/私はガラスを食べられますlevel_one");
54?>
55--EXPECTF--
56*** Testing opendir() : basic functionality ***
57
58-- Testing opendir() with absolute path: --
59resource(%d) of type (stream)
60
61-- Testing opendir() with relative paths: --
62bool(true)
63resource(%d) of type (stream)
64
65-- Close directory handles: --
66resource(%d) of type (Unknown)
67resource(%d) of type (Unknown)
68===DONE===
69