1--TEST--
2Test scandir() function : basic functionality
3--FILE--
4<?php
5/*
6 * Test basic functionality of scandir()
7 */
8
9echo "*** Testing scandir() : basic functionality ***\n";
10
11// include file.inc for create_files function
12include (__DIR__ . '/../file/file.inc');
13
14// set up directory
15$directory = __DIR__ . '/scandir_basic';
16mkdir($directory);
17create_files($directory, 3);
18
19echo "\n-- scandir() with mandatory arguments --\n";
20var_dump(scandir($directory));
21
22echo "\n-- scandir() with all arguments --\n";
23$sorting_order = SCANDIR_SORT_DESCENDING;
24$context = stream_context_create();
25var_dump(scandir($directory, $sorting_order, $context));
26
27delete_files($directory, 3);
28?>
29--CLEAN--
30<?php
31$directory = __DIR__ . '/scandir_basic';
32rmdir($directory);
33?>
34--EXPECT--
35*** Testing scandir() : basic functionality ***
36
37-- scandir() with mandatory arguments --
38array(5) {
39  [0]=>
40  string(1) "."
41  [1]=>
42  string(2) ".."
43  [2]=>
44  string(9) "file1.tmp"
45  [3]=>
46  string(9) "file2.tmp"
47  [4]=>
48  string(9) "file3.tmp"
49}
50
51-- scandir() with all arguments --
52array(5) {
53  [0]=>
54  string(9) "file3.tmp"
55  [1]=>
56  string(9) "file2.tmp"
57  [2]=>
58  string(9) "file1.tmp"
59  [3]=>
60  string(2) ".."
61  [4]=>
62  string(1) "."
63}
64