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

1.1       misho       1: --TEST--
                      2: Phar::setAlias() error zip-based
                      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: 
                     11: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.zip';
                     12: 
                     13: $phar = new Phar($fname);
                     14: $phar->setStub('<?php echo "first stub\n"; __HALT_COMPILER(); ?>');
                     15: $phar->setAlias('hio');
                     16: 
                     17: $files = array();
                     18: 
                     19: $files['a'] = 'a';
                     20: $files['b'] = 'b';
                     21: $files['c'] = 'c';
                     22: 
                     23: foreach ($files as $n => $file) {
                     24:        $phar[$n] = $file;
                     25: }
                     26: $phar->stopBuffering();
                     27: 
                     28: echo $phar->getAlias() . "\n";
                     29: $phar->setAlias('test');
                     30: echo $phar->getAlias() . "\n";
                     31: $b = $phar;
                     32: $phar = new Phar(dirname(__FILE__) . '/notphar.phar');
                     33: try {
                     34:        $phar->setAlias('test');
                     35: } catch (Exception $e) {
                     36:        echo $e->getMessage() . "\n";
                     37: }
                     38: ?>
                     39: ===DONE===
                     40: --CLEAN--
                     41: <?php 
                     42: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.zip');
                     43: __HALT_COMPILER();
                     44: ?>
                     45: --EXPECTF--
                     46: hio
                     47: test
                     48: alias "test" is already used for archive "%sphar_setalias2.phar.zip" and cannot be used for other archives
                     49: ===DONE===

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