Annotation of embedaddon/php/ext/phar/tests/zip/open_for_write_newfile.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Phar: fopen a .phar for writing (new file) zip-based
        !             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->setStub('<?php __HALT_COMPILER(); ?>');
        !            16: 
        !            17: $files = array();
        !            18: 
        !            19: $files['a.php'] = '<?php echo "This is a\n"; ?>';
        !            20: $files['b.php'] = '<?php echo "This is b\n"; ?>';
        !            21: $files['b/c.php'] = '<?php echo "This is b/c\n"; ?>';
        !            22: 
        !            23: foreach ($files as $n => $file) {
        !            24:        $phar[$n] = $file;
        !            25: }
        !            26: $phar->stopBuffering();
        !            27: 
        !            28: $fp = fopen($alias . '/b/new.php', 'wb');
        !            29: fwrite($fp, b'extra');
        !            30: fclose($fp);
        !            31: 
        !            32: include $alias . '/b/c.php';
        !            33: include $alias . '/b/new.php';
        !            34: ?>
        !            35: 
        !            36: ===DONE===
        !            37: --CLEAN--
        !            38: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip'); ?>
        !            39: --EXPECT--
        !            40: This is b/c
        !            41: extra
        !            42: ===DONE===

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