Annotation of embedaddon/php/ext/phar/tests/zip/delete_in_phar_confirm.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Phar: delete a file within a zip-based .phar (confirm disk file is changed)
                      3: --SKIPIF--
                      4: <?php if (!extension_loaded("phar")) die("skip"); ?>
                      5: --INI--
                      6: phar.readonly=0
                      7: phar.require_hash=0
                      8: --FILE--
                      9: <?php
                     10: 
                     11: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip';
                     12: $alias = 'phar://' . $fname;
                     13: 
                     14: $phar = new Phar($fname);
                     15: $phar['a.php'] = '<?php echo "This is a\n"; ?>';
                     16: $phar['b.php'] = '<?php echo "This is b\n"; ?>';
                     17: $phar['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
                     18: $phar->setStub('<?php __HALT_COMPILER(); ?>');
                     19: $phar->stopBuffering();
                     20: 
                     21: include $alias . '/a.php';
                     22: include $alias . '/b.php';
                     23: include $alias . '/b/c.php';
                     24: 
                     25: $md5 = md5_file($fname);
                     26: unlink($alias . '/b/c.php');
                     27: clearstatcache();
                     28: $md52 = md5_file($fname);
                     29: if ($md5 == $md52) echo 'file was not modified';
                     30: ?>
                     31: ===AFTER===
                     32: <?php
                     33: include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip/a.php';
                     34: include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip/b.php';
                     35: include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip/b/c.php';
                     36: ?>
                     37: 
                     38: ===DONE===
                     39: --CLEAN--
                     40: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
                     41: --EXPECTF--
                     42: This is a
                     43: This is b
                     44: This is b/c
                     45: ===AFTER===
                     46: This is a
                     47: This is b
                     48: 
                     49: Warning: include(%sdelete_in_phar_confirm.phar.zip/b/c.php): failed to open stream: phar error: "b/c.php" is not a file in phar "%sdelete_in_phar_confirm.phar.zip" in %sdelete_in_phar_confirm.php on line %d
                     50: 
                     51: Warning: include(): Failed opening 'phar://%sdelete_in_phar_confirm.phar.zip/b/c.php' for inclusion (include_path='%s') in %sdelete_in_phar_confirm.php on line %d
                     52: 
                     53: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>