]> granicus.if.org Git - php/commitdiff
new test for dir iteration (covers some code missing in gcov tests)
authorGreg Beaver <cellog@php.net>
Sun, 25 Nov 2007 05:15:50 +0000 (05:15 +0000)
committerGreg Beaver <cellog@php.net>
Sun, 25 Nov 2007 05:15:50 +0000 (05:15 +0000)
ext/phar/tests/phar_dir_iterate.phpt [new file with mode: 0644]

diff --git a/ext/phar/tests/phar_dir_iterate.phpt b/ext/phar/tests/phar_dir_iterate.phpt
new file mode 100644 (file)
index 0000000..a0a283a
--- /dev/null
@@ -0,0 +1,31 @@
+--TEST--
+Phar object: iterate test with sub-directories and RecursiveIteratorIterator
+--SKIPIF--
+<?php if (!extension_loaded('phar')) die('skip'); ?>
+<?php if (!extension_loaded("spl")) print "skip SPL not available"; ?>
+--INI--
+phar.readonly=0
+phar.require_hash=0
+--FILE--
+<?php
+
+$phar = new Phar(dirname(__FILE__) . '/test.phar');
+$phar['top.txt'] = 'hi';
+$phar['sub/top.txt'] = 'there';
+$phar['another.file.txt'] = 'wowee';
+$newphar = new Phar(dirname(__FILE__) . '/test.phar');
+foreach (new RecursiveIteratorIterator($newphar) as $path => $obj) {
+       var_dump($obj->getPathName());
+}
+?>
+===DONE===
+--CLEAN--
+<?php 
+unlink(dirname(__FILE__) . '/test.phar');
+__halt_compiler();
+?>
+--EXPECTF--
+string(%d) "phar://%stest.phar/another.file.txt"
+string(%d) "phar://%stest.phar/sub/top.txt"
+string(%d) "phar://%stest.phar/top.txt"
+===DONE===