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

1.1     ! misho       1: --TEST--
        !             2: Phar::setStub()/getStub()
        !             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: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
        !            11: $pname = 'phar://' . $fname;
        !            12: $stub = b'<?php echo "first stub\n"; __HALT_COMPILER(); ?>';
        !            13: $file = $stub;
        !            14: 
        !            15: $files = array();
        !            16: $files['a'] = 'a';
        !            17: 
        !            18: include 'files/phar_test.inc';
        !            19: 
        !            20: $phar = new Phar($fname);
        !            21: var_dump($stub);
        !            22: var_dump($phar->getStub());
        !            23: var_dump($phar->getStub() == $stub);
        !            24: 
        !            25: $newstub = '<?php echo "second stub\n"; _x_HALT_COMPILER(); ?>';
        !            26: try
        !            27: {
        !            28:        $phar->setStub($newstub);
        !            29: }
        !            30: catch(exception $e)
        !            31: {
        !            32:        echo 'Exception: ' . $e->getMessage() . "\n";
        !            33: }
        !            34: var_dump($phar->getStub());
        !            35: var_dump($phar->getStub() == $stub);
        !            36: $phar->stopBuffering();
        !            37: var_dump($phar->getStub());
        !            38: var_dump($phar->getStub() == $stub);
        !            39: 
        !            40: ?>
        !            41: ===DONE===
        !            42: --CLEAN--
        !            43: <?php 
        !            44: unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
        !            45: __HALT_COMPILER();
        !            46: ?>
        !            47: --EXPECTF--
        !            48: string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>"
        !            49: string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>"
        !            50: bool(true)
        !            51: Exception: illegal stub for phar "%sphar_stub_error.phar.php"
        !            52: string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>"
        !            53: bool(true)
        !            54: string(48) "<?php echo "first stub\n"; __HALT_COMPILER(); ?>"
        !            55: bool(true)
        !            56: ===DONE===

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