xref: /PHP-7.1/ext/phar/tests/phar_oo_003.phpt (revision 7af945e2)
1--TEST--
2Phar object: entry & openFile()
3--SKIPIF--
4<?php if (!extension_loaded("phar")) die("skip"); ?>
5<?php if (!extension_loaded("spl")) die("skip SPL not available"); ?>
6--INI--
7phar.require_hash=0
8--FILE--
9<?php
10
11require_once 'files/phar_oo_test.inc';
12
13$phar = new Phar($fname);
14$phar->setInfoClass();
15foreach($phar as $name => $ent)
16{
17	var_dump($ent->getFilename());
18	if ($ent->isDir()) {
19		var_dump('DIR');
20	} else {
21		var_dump($ent->openFile()->fgets());
22		include $ent->getPathName();
23	}
24}
25
26?>
27===DONE===
28--CLEAN--
29<?php
30unlink(dirname(__FILE__) . '/files/phar_oo_003.phar.php');
31__halt_compiler();
32?>
33--EXPECTF--
34string(5) "a.php"
35string(32) "<?php echo "This is a.php\n"; ?>"
36This is a.php
37string(1) "b"
38%s(3) "DIR"
39string(5) "b.php"
40string(32) "<?php echo "This is b.php\n"; ?>"
41This is b.php
42string(5) "e.php"
43string(32) "<?php echo "This is e.php\n"; ?>"
44This is e.php
45===DONE===
46