Annotation of embedaddon/php/ext/phar/tests/create_new_and_modify.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Phar: create and modify phar
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded("phar")) die("skip"); ?>
! 5: <?php if (!extension_loaded("spl")) die("skip SPL not available"); ?>
! 6: --INI--
! 7: phar.readonly=0
! 8: phar.require_hash=1
! 9: --FILE--
! 10: <?php
! 11:
! 12: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
! 13: $pname = 'phar://' . $fname;
! 14:
! 15: @unlink($fname);
! 16:
! 17: file_put_contents($pname . '/a.php', "brand new!\n");
! 18:
! 19: $phar = new Phar($fname);
! 20: $sig1 = $phar->getSignature();
! 21:
! 22: include $pname . '/a.php';
! 23:
! 24: file_put_contents($pname .'/a.php', "modified!\n");
! 25: file_put_contents($pname .'/b.php', "another!\n");
! 26:
! 27: $phar = new Phar($fname);
! 28: $sig2 = $phar->getSignature();
! 29:
! 30: var_dump($sig1[b'hash']);
! 31: var_dump($sig2[b'hash']);
! 32: var_dump($sig1[b'hash'] != $sig2[b'hash']);
! 33:
! 34: include $pname . '/a.php';
! 35: include $pname . '/b.php';
! 36:
! 37: ?>
! 38: ===DONE===
! 39: --CLEAN--
! 40: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
! 41: --EXPECTF--
! 42: brand new!
! 43: string(40) "%s"
! 44: string(40) "%s"
! 45: bool(true)
! 46: modified!
! 47: another!
! 48: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>