unixzip.phpt 709 B

1234567891011121314151617181920212223242526272829
  1. --TEST--
  2. Phar: test a zip archive created by unix "zip" command
  3. --SKIPIF--
  4. <?php if (!extension_loaded("phar")) die("skip"); ?>
  5. <?php if (!extension_loaded("spl")) die("skip SPL not available"); ?>
  6. --FILE--
  7. <?php
  8. $a = new PharData(dirname(__FILE__) . '/files/zip.zip');
  9. foreach ($a as $b) {
  10. if ($b->isDir()) {
  11. echo "dir " . $b->getPathName() . "\n";
  12. } else {
  13. echo $b->getPathName(), "\n";
  14. echo file_get_contents($b->getPathName()), "\n";
  15. }
  16. }
  17. if (isset($a['notempty/hi.txt'])) {
  18. echo $a['notempty/hi.txt']->getPathName() . "\n";
  19. }
  20. ?>
  21. ===DONE===
  22. --EXPECTF--
  23. dir phar://%s/zip.zip%cempty
  24. phar://%s/zip.zip%chi.txt
  25. hi there
  26. dir phar://%s/zip.zip%cnotempty
  27. phar://%s/zip.zip/notempty%chi.txt
  28. ===DONE===