1--TEST--
2Test readdir() 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/*
12 * Test basic functionality of readdir()
13 */
14
15echo "*** Testing readdir() : basic functionality ***\n";
16
17// include the file.inc for Function: function create_files()
18chdir(__DIR__);
19include(__DIR__."/../file/file.inc");
20
21$path = __DIR__ . '/私はガラスを食べられますreaddir_basic';
22mkdir($path);
23create_files($path, 3);
24
25echo "\n-- Call readdir() with \$path argument --\n";
26var_dump($dh = opendir($path));
27$a = array();
28while( FALSE !== ($file = readdir($dh)) ) {
29    $a[] = $file;
30}
31sort($a);
32foreach($a as $file) {
33    var_dump($file);
34}
35
36echo "\n-- Call readdir() without \$path argument --\n";
37var_dump($dh = opendir($path));
38$a = array();
39while( FALSE !== ( $file = readdir() ) ) {
40    $a[] = $file;
41}
42sort($a);
43foreach($a as $file) {
44    var_dump($file);
45}
46
47delete_files($path, 3);
48closedir($dh);
49?>
50--CLEAN--
51<?php
52$path = __DIR__ . '/私はガラスを食べられますreaddir_basic';
53rmdir($path);
54?>
55--EXPECTF--
56*** Testing readdir() : basic functionality ***
57
58-- Call readdir() with $path argument --
59resource(%d) of type (stream)
60string(1) "."
61string(2) ".."
62string(9) "file1.tmp"
63string(9) "file2.tmp"
64string(9) "file3.tmp"
65
66-- Call readdir() without $path argument --
67resource(%d) of type (stream)
68string(1) "."
69string(2) ".."
70string(9) "file1.tmp"
71string(9) "file2.tmp"
72string(9) "file3.tmp"
73