Annotation of embedaddon/php/ext/phar/tests/019b.phpt, revision 1.1.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:        }
                     43: }
                     44: 
                     45: dump('phar://hio', '/');
                     46: 
                     47: ?>
                     48: --CLEAN--
                     49: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
                     50: --EXPECT--
                     51: string(11) "phar://hio/"
                     52: string(2) "/a"
                     53: bool(false)
                     54: string(2) "/b"
                     55: bool(true)
                     56: string(12) "phar://hio/b"
                     57: string(4) "/b/a"
                     58: bool(false)
                     59: string(4) "/b/c"
                     60: bool(true)
                     61: string(14) "phar://hio/b/c"
                     62: string(6) "/b/c/d"
                     63: bool(false)
                     64: string(4) "/bad"
                     65: bool(true)
                     66: string(14) "phar://hio/bad"
                     67: string(6) "/bad/c"
                     68: bool(false)

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