Skip to content

Commit 38fc1fb

Browse files
author
Greg Beaver
committed
new test for dir iteration (covers some code missing in gcov tests)
1 parent 4bcb68a commit 38fc1fb

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

ext/phar/tests/phar_dir_iterate.phpt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
--TEST--
2+
Phar object: iterate test with sub-directories and RecursiveIteratorIterator
3+
--SKIPIF--
4+
<?php if (!extension_loaded('phar')) die('skip'); ?>
5+
<?php if (!extension_loaded("spl")) print "skip SPL not available"; ?>
6+
--INI--
7+
phar.readonly=0
8+
phar.require_hash=0
9+
--FILE--
10+
<?php
11+
12+
$phar = new Phar(dirname(__FILE__) . '/test.phar');
13+
$phar['top.txt'] = 'hi';
14+
$phar['sub/top.txt'] = 'there';
15+
$phar['another.file.txt'] = 'wowee';
16+
$newphar = new Phar(dirname(__FILE__) . '/test.phar');
17+
foreach (new RecursiveIteratorIterator($newphar) as $path => $obj) {
18+
var_dump($obj->getPathName());
19+
}
20+
?>
21+
===DONE===
22+
--CLEAN--
23+
<?php
24+
unlink(dirname(__FILE__) . '/test.phar');
25+
__halt_compiler();
26+
?>
27+
--EXPECTF--
28+
string(%d) "phar://%stest.phar/another.file.txt"
29+
string(%d) "phar://%stest.phar/sub/top.txt"
30+
string(%d) "phar://%stest.phar/top.txt"
31+
===DONE===

0 commit comments

Comments
 (0)