xref: /PHP-7.4/ext/phar/tests/phar_oo_005.phpt (revision 26dfce7f)
1--TEST--
2Phar and RecursiveDirectoryIterator
3--SKIPIF--
4<?php
5if (!extension_loaded("phar")) die("skip");
6?>
7--INI--
8phar.require_hash=0
9--FILE--
10<?php
11
12require_once 'files/phar_oo_test.inc';
13$fname = str_replace('\\', '/', $fname);
14
15$it = new RecursiveDirectoryIterator('phar://'.$fname);
16$it = new RecursiveIteratorIterator($it);
17
18foreach($it as $name => $ent)
19{
20	var_dump(str_replace(array('\\', $fname), array('/', '*'), $name));
21	var_dump(str_replace(array('\\', $fname), array('/', '*'), $ent->getPathname()));
22	var_dump(str_replace('\\', '/', $it->getSubPath()));
23	var_dump(str_replace('\\', '/', $it->getSubPathName()));
24	$sub = $it->getPathInfo();
25	var_dump(str_replace('\\', '/', $sub->getFilename()));
26}
27
28?>
29===DONE===
30--CLEAN--
31<?php
32unlink(__DIR__ . '/files/phar_oo_005.phar.php');
33__halt_compiler();
34?>
35--EXPECT--
36string(14) "phar://*/a.php"
37string(14) "phar://*/a.php"
38string(0) ""
39string(5) "a.php"
40string(20) "phar_oo_005.phar.php"
41string(16) "phar://*/b/c.php"
42string(16) "phar://*/b/c.php"
43string(1) "b"
44string(7) "b/c.php"
45string(1) "b"
46string(16) "phar://*/b/d.php"
47string(16) "phar://*/b/d.php"
48string(1) "b"
49string(7) "b/d.php"
50string(1) "b"
51string(14) "phar://*/b.php"
52string(14) "phar://*/b.php"
53string(0) ""
54string(5) "b.php"
55string(20) "phar_oo_005.phar.php"
56string(14) "phar://*/e.php"
57string(14) "phar://*/e.php"
58string(0) ""
59string(5) "e.php"
60string(20) "phar_oo_005.phar.php"
61===DONE===
62