Annotation of embedaddon/php/ext/phar/tests/tar/phar_convert_phar2.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Phar::convertToPhar() gzipped
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("phar")) die("skip"); ?>
! 5: <?php if (!extension_loaded("zlib")) die("skip"); ?>
! 6: --INI--
! 7: phar.require_hash=0
! 8: phar.readonly=0
! 9: --FILE--
! 10: <?php
! 11:
! 12: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar';
! 13: $fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '2.phar';
! 14:
! 15: $phar = new Phar($fname);
! 16: $phar['a.txt'] = 'some text';
! 17: $phar->stopBuffering();
! 18: var_dump($phar->isFileFormat(Phar::TAR));
! 19: var_dump(strlen($phar->getStub()));
! 20:
! 21: $phar = $phar->convertToExecutable(Phar::TAR);
! 22: var_dump($phar->isFileFormat(Phar::TAR));
! 23: var_dump($phar->getStub());
! 24:
! 25: $phar['a'] = 'hi there';
! 26:
! 27: $phar = $phar->convertToExecutable(Phar::PHAR, Phar::GZ);
! 28: var_dump($phar->isFileFormat(Phar::PHAR));
! 29: var_dump($phar->isCompressed());
! 30: var_dump(strlen($phar->getStub()));
! 31:
! 32: copy($fname . '.gz', $fname2);
! 33:
! 34: $phar = new Phar($fname2);
! 35: var_dump($phar->isFileFormat(Phar::PHAR));
! 36: var_dump($phar->isCompressed() == Phar::GZ);
! 37: var_dump(strlen($phar->getStub()));
! 38:
! 39: ?>
! 40: ===DONE===
! 41: --CLEAN--
! 42: <?php
! 43: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar');
! 44: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.gz');
! 45: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar');
! 46: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.tar.gz');
! 47: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '2.phar');
! 48: __HALT_COMPILER();
! 49: ?>
! 50: --EXPECT--
! 51: bool(false)
! 52: int(6683)
! 53: bool(true)
! 54: string(60) "<?php // tar-based phar archive stub file
! 55: __HALT_COMPILER();"
! 56: bool(true)
! 57: int(4096)
! 58: int(6683)
! 59: bool(true)
! 60: bool(true)
! 61: int(6683)
! 62: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>