xref: /PHP-7.0/ext/phar/tests/phar_oo_002U.phpt (revision e3de409e)
1--TEST--
2Phar object: iterator & entries
3--SKIPIF--
4<?php
5if (!extension_loaded("phar")) die("skip");
6if (version_compare(PHP_VERSION, "6.0", "!=")) die("skip requires Unicode support");
7if (!extension_loaded("spl")) die("skip SPL not available");
8?>
9--INI--
10phar.readonly=1
11phar.require_hash=0
12--FILE--
13<?php
14
15require_once 'files/phar_oo_test.inc';
16
17$phar = new Phar($fname);
18$phar->setInfoClass('SplFileInfo');
19foreach($phar as $name => $ent)
20{
21	var_dump(str_replace(str_replace('\\', '/', dirname(__FILE__)), '*', $name));
22	var_dump($ent->getFilename());
23	var_dump($ent->getSize());
24	var_dump($ent->getType());
25	var_dump($ent->isWritable());
26	var_dump($ent->isReadable());
27	var_dump($ent->isExecutable());
28	var_dump($ent->isFile());
29	var_dump($ent->isDir());
30	var_dump($ent->isLink());
31	var_dump($ent->getCTime());
32	var_dump($ent->getMTime());
33	var_dump($ent->getATime());
34}
35
36echo "==RECURSIVE==\n";
37
38$phar = new Phar($fname);
39foreach(new RecursiveIteratorIterator($phar) as $name => $ent)
40{
41	var_dump(str_replace(str_replace('\\', '/', dirname(__FILE__)), '*', $name));
42	var_dump(str_replace('\\', '/', $ent->getFilename()));
43	var_dump($ent->getCompressedSize());
44	var_dump($ent->isCRCChecked());
45	var_dump($ent->isCRCChecked() ? $ent->getCRC32() : NULL);
46	var_dump($ent->getPharFlags());
47}
48
49?>
50===DONE===
51--CLEAN--
52<?php
53unlink(dirname(__FILE__) . '/files/phar_oo_002U.phar.php');
54__halt_compiler();
55?>
56--EXPECTF--
57unicode(42) "phar://*/files/phar_oo_002.phar.php%ca.php"
58string(5) "a.php"
59int(32)
60unicode(4) "file"
61bool(false)
62bool(true)
63bool(false)
64bool(true)
65bool(false)
66bool(false)
67int(%d)
68int(%d)
69int(%d)
70unicode(38) "phar://*/files/phar_oo_002.phar.php%cb"
71string(1) "b"
72int(0)
73unicode(3) "dir"
74bool(false)
75bool(true)
76bool(false)
77bool(false)
78bool(true)
79bool(false)
80int(%d)
81int(%d)
82int(%d)
83unicode(42) "phar://*/files/phar_oo_002.phar.php%cb.php"
84string(5) "b.php"
85int(32)
86unicode(4) "file"
87bool(false)
88bool(true)
89bool(false)
90bool(true)
91bool(false)
92bool(false)
93int(%d)
94int(%d)
95int(%d)
96unicode(42) "phar://*/files/phar_oo_002.phar.php%ce.php"
97string(5) "e.php"
98int(32)
99unicode(4) "file"
100bool(false)
101bool(true)
102bool(false)
103bool(true)
104bool(false)
105bool(false)
106int(%d)
107int(%d)
108int(%d)
109==RECURSIVE==
110unicode(42) "phar://*/files/phar_oo_002.phar.php%ca.php"
111unicode(5) "a.php"
112int(32)
113bool(false)
114NULL
115int(0)
116unicode(44) "phar://*/files/phar_oo_002.phar.php/b%cc.php"
117unicode(5) "c.php"
118int(34)
119bool(false)
120NULL
121int(0)
122unicode(44) "phar://*/files/phar_oo_002.phar.php/b%cd.php"
123unicode(5) "d.php"
124int(34)
125bool(false)
126NULL
127int(0)
128unicode(42) "phar://*/files/phar_oo_002.phar.php%cb.php"
129unicode(5) "b.php"
130int(32)
131bool(false)
132NULL
133int(0)
134unicode(42) "phar://*/files/phar_oo_002.phar.php%ce.php"
135unicode(5) "e.php"
136int(32)
137bool(false)
138NULL
139int(0)
140===DONE===
141