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