1--TEST--
2Test scandir() function : usage variations - different sorting constants
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) != 'WIN') {
6  die("skip Valid only on Windows");
7}
8?>
9--FILE--
10<?php
11printf("SCANDIR_SORT_ASCENDING: %d\n", SCANDIR_SORT_ASCENDING);
12printf("SCANDIR_SORT_DESCENDING: %d\n", SCANDIR_SORT_DESCENDING);
13printf("SCANDIR_SORT_NONE: %d\n", SCANDIR_SORT_NONE);
14
15/*
16 * Pass different integers as $sorting_order argument to test how scandir()
17 * re-orders the array
18 */
19
20echo "*** Testing scandir() : usage variations ***\n";
21
22// include for create_files/delete_files functions
23include(__DIR__ . '/../file/file.inc');
24
25// create directory and files
26$dir = __DIR__ . '/私はガラスを食べられますscandir_variation10';
27mkdir($dir);
28@create_files($dir, 2, "numeric", 0755, 1, "w", "私はガラスを食べられますfile");
29
30// Deterministic tests.
31var_dump(scandir($dir, SCANDIR_SORT_ASCENDING));
32var_dump(scandir($dir, SCANDIR_SORT_DESCENDING));
33
34// Non-deterministic tests.
35$files = scandir($dir, SCANDIR_SORT_NONE);
36var_dump(count($files));
37var_dump(in_array('.', $files));
38var_dump(in_array('..', $files));
39var_dump(in_array('私はガラスを食べられますfile1.tmp', $files));
40var_dump(in_array('私はガラスを食べられますfile2.tmp', $files));
41
42delete_files($dir, 2, "私はガラスを食べられますfile");
43?>
44--CLEAN--
45<?php
46$dir = __DIR__ . '/私はガラスを食べられますscandir_variation10';
47rmdir($dir);
48?>
49--EXPECT--
50SCANDIR_SORT_ASCENDING: 0
51SCANDIR_SORT_DESCENDING: 1
52SCANDIR_SORT_NONE: 2
53*** Testing scandir() : usage variations ***
54array(4) {
55  [0]=>
56  string(1) "."
57  [1]=>
58  string(2) ".."
59  [2]=>
60  string(45) "私はガラスを食べられますfile1.tmp"
61  [3]=>
62  string(45) "私はガラスを食べられますfile2.tmp"
63}
64array(4) {
65  [0]=>
66  string(45) "私はガラスを食べられますfile2.tmp"
67  [1]=>
68  string(45) "私はガラスを食べられますfile1.tmp"
69  [2]=>
70  string(2) ".."
71  [3]=>
72  string(1) "."
73}
74int(4)
75bool(true)
76bool(true)
77bool(true)
78bool(true)
79