Annotation of embedaddon/php/ext/phar/tests/zip/create_new_and_modify.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar: create and modify zip-based 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: --FILE--
9: <?php
10:
11: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip.php';
12: $pname = 'phar://' . $fname;
13:
14: @unlink($fname);
15:
16: file_put_contents($pname . '/a.php', "brand new!\n");
17:
18: $phar = new Phar($fname);
19: var_dump($phar->isFileFormat(Phar::ZIP));
20: $sig1 = md5_file($fname);
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 = md5_file($fname);
29:
30: var_dump($sig1 != $sig2);
31:
32: include $pname . '/a.php';
33: include $pname . '/b.php';
34:
35: ?>
36: ===DONE===
37: --CLEAN--
38: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip.php'); ?>
39: --EXPECTF--
40: bool(true)
41: brand new!
42: bool(true)
43: modified!
44: another!
45: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>