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