xref: /PHP-8.0/ext/phar/tests/phar_oo_005.phpt (revision f8d79582)
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--CLEAN--
30<?php
31unlink(__DIR__ . '/files/phar_oo_005.phar.php');
32__halt_compiler();
33?>
34--EXPECT--
35string(14) "phar://*/a.php"
36string(14) "phar://*/a.php"
37string(0) ""
38string(5) "a.php"
39string(20) "phar_oo_005.phar.php"
40string(16) "phar://*/b/c.php"
41string(16) "phar://*/b/c.php"
42string(1) "b"
43string(7) "b/c.php"
44string(1) "b"
45string(16) "phar://*/b/d.php"
46string(16) "phar://*/b/d.php"
47string(1) "b"
48string(7) "b/d.php"
49string(1) "b"
50string(14) "phar://*/b.php"
51string(14) "phar://*/b.php"
52string(0) ""
53string(5) "b.php"
54string(20) "phar_oo_005.phar.php"
55string(14) "phar://*/e.php"
56string(14) "phar://*/e.php"
57string(0) ""
58string(5) "e.php"
59string(20) "phar_oo_005.phar.php"
60