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

1.1       misho       1: --TEST--
                      2: Phar and DirectoryIterator
                      3: --SKIPIF--
                      4: <?php
                      5: if (!extension_loaded("phar")) die("skip");
                      6: if (!extension_loaded("spl")) die("skip SPL not available");
                      7: if (version_compare(PHP_VERSION, "6.0", ">")) die("skip pre-unicode version of PHP required");
                      8: ?>
                      9: --INI--
                     10: phar.require_hash=0
                     11: --FILE--
                     12: <?php
                     13: 
                     14: require_once 'files/phar_oo_test.inc';
                     15: 
                     16: $it = new DirectoryIterator('phar://'.$fname);
                     17: 
                     18: foreach($it as $name => $ent)
                     19: {
                     20:        var_dump($name);
                     21:        var_dump($ent->getFilename());
                     22:        var_dump($ent->isDir());
                     23:        var_dump($ent->isDot());
                     24: }
                     25: 
                     26: ?>
                     27: ===MANUAL===
                     28: <?php
                     29: 
                     30: class MyDirectoryIterator extends DirectoryIterator
                     31: {
                     32:        function __construct($dir)
                     33:        {
                     34:                echo __METHOD__ . "\n";
                     35:                parent::__construct($dir);
                     36:        }
                     37: 
                     38:        function rewind()
                     39:        {
                     40:                echo __METHOD__ . "\n";
                     41:                parent::rewind();
                     42:        }
                     43: 
                     44:        function valid()
                     45:        {
                     46:                echo __METHOD__ . "\n";
                     47:                return parent::valid();
                     48:        }
                     49: 
                     50:        function key()
                     51:        {
                     52:                echo __METHOD__ . "\n";
                     53:                return parent::key();
                     54:        }
                     55: 
                     56:        function current()
                     57:        {
                     58:                echo __METHOD__ . "\n";
                     59:                return parent::current();
                     60:        }
                     61: 
                     62:        function next()
                     63:        {
                     64:                echo __METHOD__ . "\n";
                     65:                parent::next();
                     66:        }
                     67: }
                     68: 
                     69: $it = new MyDirectoryIterator('phar://'.$fname);
                     70: 
                     71: foreach($it as $name => $ent)
                     72: {
                     73:        var_dump($name);
                     74:        var_dump($ent->getFilename());
                     75: }
                     76: 
                     77: ?>
                     78: ===DONE===
                     79: --CLEAN--
                     80: <?php 
                     81: unlink(dirname(__FILE__) . '/files/phar_oo_test.phar.php');
                     82: __halt_compiler();
                     83: ?>
                     84: --EXPECT--
                     85: int(0)
                     86: string(5) "a.php"
                     87: bool(false)
                     88: bool(false)
                     89: int(1)
                     90: string(1) "b"
                     91: bool(true)
                     92: bool(false)
                     93: int(2)
                     94: string(5) "b.php"
                     95: bool(false)
                     96: bool(false)
                     97: int(3)
                     98: string(5) "e.php"
                     99: bool(false)
                    100: bool(false)
                    101: ===MANUAL===
                    102: MyDirectoryIterator::__construct
                    103: MyDirectoryIterator::rewind
                    104: MyDirectoryIterator::valid
                    105: MyDirectoryIterator::current
                    106: MyDirectoryIterator::key
                    107: int(0)
                    108: string(5) "a.php"
                    109: MyDirectoryIterator::next
                    110: MyDirectoryIterator::valid
                    111: MyDirectoryIterator::current
                    112: MyDirectoryIterator::key
                    113: int(1)
                    114: string(1) "b"
                    115: MyDirectoryIterator::next
                    116: MyDirectoryIterator::valid
                    117: MyDirectoryIterator::current
                    118: MyDirectoryIterator::key
                    119: int(2)
                    120: string(5) "b.php"
                    121: MyDirectoryIterator::next
                    122: MyDirectoryIterator::valid
                    123: MyDirectoryIterator::current
                    124: MyDirectoryIterator::key
                    125: int(3)
                    126: string(5) "e.php"
                    127: MyDirectoryIterator::next
                    128: MyDirectoryIterator::valid
                    129: ===DONE===

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