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

1.1     ! misho       1: --TEST--
        !             2: Phar with meta-data (read)
        !             3: --SKIPIF--
        !             4: <?php
        !             5: if (!extension_loaded("phar")) die("skip");
        !             6: if (version_compare(PHP_VERSION, "6.0", ">")) die("skip pre-unicode version of PHP required");
        !             7: ?>
        !             8: --INI--
        !             9: phar.require_hash=0
        !            10: --FILE--
        !            11: <?php
        !            12: $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
        !            13: $pname = 'phar://' . $fname;
        !            14: $file = "<?php __HALT_COMPILER(); ?>";
        !            15: 
        !            16: $files = array();
        !            17: $files['a'] = array('cont' => 'a');
        !            18: $files['b'] = array('cont' => 'b', 'meta' => 'hi there');
        !            19: $files['c'] = array('cont' => 'c', 'meta' => array('hi', 'there'));
        !            20: $files['d'] = array('cont' => 'd', 'meta' => array('hi'=>'there','foo'=>'bar'));
        !            21: include 'files/phar_test.inc';
        !            22: 
        !            23: foreach($files as $name => $cont) {
        !            24:        var_dump(file_get_contents($pname.'/'.$name));
        !            25: }
        !            26: 
        !            27: $phar = new Phar($fname);
        !            28: foreach($files as $name => $cont) {
        !            29:        var_dump($phar[$name]->getMetadata());
        !            30: }
        !            31: 
        !            32: unset($phar);
        !            33: 
        !            34: foreach($files as $name => $cont) {
        !            35:        var_dump(file_get_contents($pname.'/'.$name));
        !            36: }
        !            37: ?>
        !            38: ===DONE===
        !            39: --CLEAN--
        !            40: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
        !            41: --EXPECT--
        !            42: string(1) "a"
        !            43: string(1) "b"
        !            44: string(1) "c"
        !            45: string(1) "d"
        !            46: NULL
        !            47: string(8) "hi there"
        !            48: array(2) {
        !            49:   [0]=>
        !            50:   string(2) "hi"
        !            51:   [1]=>
        !            52:   string(5) "there"
        !            53: }
        !            54: array(2) {
        !            55:   ["hi"]=>
        !            56:   string(5) "there"
        !            57:   ["foo"]=>
        !            58:   string(3) "bar"
        !            59: }
        !            60: string(1) "a"
        !            61: string(1) "b"
        !            62: string(1) "c"
        !            63: string(1) "d"
        !            64: ===DONE===

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