CPP builtins
[m6w6/ext-psi] / tests / glob / glob004.phpt
1 --TEST--
2 glob err
3 --INI--
4 psi.directory={PWD}/../../psi.d:{PWD}
5 --SKIPIF--
6 <?php
7 extension_loaded("psi") or die("skip - need ext/psi");
8 is_dir("/etc/sudoers.d") and !is_readable("/etc/sudoers.d") or die("skip - only for Linux with unreadable sudoers.d");
9 ?>
10 --FILE--
11 ===TEST===
12 <?php
13 var_dump(psi\GLOB_ABORTED == psi\glob("/etc/sudoers.d/*", psi\GLOB_ERR, $glob, function($epath, $eerrno) {
14 printf("%s: %s\n", psi\strerror($eerrno), $epath);
15 }));
16 var_dump($glob);
17
18 var_dump(psi\GLOB_ABORTED == psi\glob("/etc/sudoers.d/*", 0, $glob, function($epath, $eerrno) {
19 printf("%s: %s\n", psi\strerror($eerrno), $epath);
20 return 1;
21 }));
22 var_dump($glob);
23
24 var_dump(psi\GLOB_ABORTED == psi\glob("/etc/sudoers.d/*", 0, $glob, function($epath, $eerrno) {
25 printf("%s: %s\n", psi\strerror($eerrno), $epath);
26 return 0;
27 }));
28 var_dump($glob);
29 ?>
30 ===DONE===
31 --EXPECTF--
32 ===TEST===
33 Permission denied: /etc/sudoers.d
34 bool(true)
35 array(4) {
36 ["gl_pathc"]=>
37 int(0)
38 ["gl_offs"]=>
39 int(0)
40 ["gl_flags"]=>
41 int(%d)
42 ["gl_pathv"]=>
43 array(0) {
44 }
45 }
46 Permission denied: /etc/sudoers.d
47 bool(true)
48 array(4) {
49 ["gl_pathc"]=>
50 int(0)
51 ["gl_offs"]=>
52 int(0)
53 ["gl_flags"]=>
54 int(%d)
55 ["gl_pathv"]=>
56 array(0) {
57 }
58 }
59 Permission denied: /etc/sudoers.d
60 bool(false)
61 array(4) {
62 ["gl_pathc"]=>
63 int(0)
64 ["gl_offs"]=>
65 int(0)
66 ["gl_flags"]=>
67 int(%d)
68 ["gl_pathv"]=>
69 array(0) {
70 }
71 }
72 ===DONE===