phar_dir_iterate.phpt 880 B

12345678910111213141516171819202122232425262728293031
  1. --TEST--
  2. Phar object: iterate test with sub-directories and RecursiveIteratorIterator
  3. --SKIPIF--
  4. <?php if (!extension_loaded('phar')) die('skip'); ?>
  5. --INI--
  6. phar.readonly=0
  7. phar.require_hash=0
  8. --FILE--
  9. <?php
  10. $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
  11. $phar = new Phar($fname);
  12. $phar['top.txt'] = 'hi';
  13. $phar['sub/top.txt'] = 'there';
  14. $phar['another.file.txt'] = 'wowee';
  15. $newphar = new Phar($fname);
  16. foreach (new RecursiveIteratorIterator($newphar) as $path => $obj) {
  17. var_dump($obj->getPathName());
  18. }
  19. ?>
  20. ===DONE===
  21. --CLEAN--
  22. <?php
  23. unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
  24. __halt_compiler();
  25. ?>
  26. --EXPECTF--
  27. string(%d) "phar://%sphar_dir_iterate.phar.php%canother.file.txt"
  28. string(%d) "phar://%sphar_dir_iterate.phar.php/sub%ctop.txt"
  29. string(%d) "phar://%sphar_dir_iterate.phar.php%ctop.txt"
  30. ===DONE===