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