Annotation of embedaddon/php/ext/phar/tests/pharfileinfo_getcrc32.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Phar: PharFileInfo::getCRC32
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("phar")) die("skip"); ?>
! 5: --INI--
! 6: phar.require_hash=0
! 7: phar.readonly=0
! 8: --FILE--
! 9: <?php
! 10: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar';
! 11: $pname = 'phar://' . $fname;
! 12: $file = "<?php
! 13: Phar::mapPhar('hio');
! 14: __HALT_COMPILER(); ?>";
! 15:
! 16: // compressed file length does not match incompressed lentgh for an uncompressed file
! 17:
! 18: $files = array();
! 19: $files['a/subdir/here'] = array('cont'=>'a','ulen'=>1,'clen'=>1);;
! 20: include 'files/phar_test.inc';
! 21:
! 22: $b = new PharFileInfo($pname . '/a/subdir');
! 23: try {
! 24: var_dump($b->getCRC32());
! 25: } catch (Exception $e) {
! 26: echo $e->getMessage() . "\n";
! 27: }
! 28:
! 29: $b = new PharFileInfo($pname . '/a/subdir/here');
! 30: try {
! 31: var_dump($b->getCRC32());
! 32: } catch (Exception $e) {
! 33: echo $e->getMessage() . "\n";
! 34: }
! 35: $a = file_get_contents($pname . '/a/subdir/here');
! 36: try {
! 37: var_dump($b->getCRC32());
! 38: } catch (Exception $e) {
! 39: echo $e->getMessage() . "\n";
! 40: }
! 41: ?>
! 42: ===DONE===
! 43: --CLEAN--
! 44: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar'); ?>
! 45: --EXPECTF--
! 46: Phar entry is a directory, does not have a CRC
! 47: Phar entry was not CRC checked
! 48: int(%s)
! 49: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>