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

1.1     ! misho       1: --TEST--
        !             2: Phar: opendir test, recurse into
        !             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
        !            15: Phar::mapPhar('hio');
        !            16: __HALT_COMPILER(); ?>";
        !            17: 
        !            18: $files = array();
        !            19: $files['a'] = 'a';
        !            20: $files['b/a'] = 'b';
        !            21: $files['b/c/d'] = 'c';
        !            22: $files['bad/c'] = 'd';
        !            23: include 'files/phar_test.inc';
        !            24: include $fname;
        !            25: 
        !            26: function dump($phar, $base)
        !            27: {
        !            28:        var_dump($phar . $base);
        !            29:        $dir = opendir($phar . $base);
        !            30:        if ($base == '/')
        !            31:        {
        !            32:                $base = '';
        !            33:        }
        !            34:        while (false !== ($entry = readdir($dir))) {
        !            35:                $entry = $base . '/' . $entry;
        !            36:                var_dump($entry);
        !            37:                var_dump(is_dir($phar . $entry));
        !            38:                if (is_dir($phar . $entry))
        !            39:                {
        !            40:                        dump($phar, $entry);
        !            41:                }
        !            42:                else
        !            43:                {
        !            44:                        var_dump(file_get_contents($phar . $entry));
        !            45:                }
        !            46:        }
        !            47: }
        !            48: 
        !            49: dump('phar://hio', '/');
        !            50: 
        !            51: ?>
        !            52: --CLEAN--
        !            53: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
        !            54: --EXPECT--
        !            55: string(11) "phar://hio/"
        !            56: string(2) "/a"
        !            57: bool(false)
        !            58: string(1) "a"
        !            59: string(2) "/b"
        !            60: bool(true)
        !            61: string(12) "phar://hio/b"
        !            62: string(4) "/b/a"
        !            63: bool(false)
        !            64: string(1) "b"
        !            65: string(4) "/b/c"
        !            66: bool(true)
        !            67: string(14) "phar://hio/b/c"
        !            68: string(6) "/b/c/d"
        !            69: bool(false)
        !            70: string(1) "c"
        !            71: string(4) "/bad"
        !            72: bool(true)
        !            73: string(14) "phar://hio/bad"
        !            74: string(6) "/bad/c"
        !            75: bool(false)
        !            76: string(1) "d"

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