Annotation of embedaddon/php/ext/spl/tests/array_007.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: SPL: ArrayObject/Iterator from IteratorAggregate
                      3: --FILE--
                      4: <?php
                      5: 
                      6: // This test also needs to exclude the protected and private variables 
                      7: // since they cannot be accessed from the external object which iterates 
                      8: // them.
                      9: 
                     10: class test implements IteratorAggregate
                     11: {
                     12:        public    $pub = "public";
                     13:        protected $pro = "protected";
                     14:        private   $pri = "private";
                     15:        
                     16:        function __construct()
                     17:        {
                     18:                $this->imp = "implicit";
                     19:        }
                     20:        
                     21:        function getIterator()
                     22:        {
                     23:                $it = new ArrayObject($this);
                     24:                return $it->getIterator();
                     25:        }
                     26: };
                     27: 
                     28: $test = new test;
                     29: $test->dyn = "dynamic";
                     30: 
                     31: print_r($test);
                     32: 
                     33: print_r($test->getIterator());
                     34: 
                     35: foreach($test as $key => $val)
                     36: {
                     37:        echo "$key => $val\n";
                     38: }
                     39: 
                     40: ?>
                     41: ===DONE===
                     42: <?php exit(0); ?>
                     43: --EXPECTF--
                     44: test Object
                     45: (
                     46:     [pub] => public
                     47:     [pro:protected] => protected
                     48:     [pri:test:private] => private
                     49:     [imp] => implicit
                     50:     [dyn] => dynamic
                     51: )
                     52: ArrayIterator Object
                     53: (
                     54:     [storage:ArrayIterator:private] => ArrayObject Object
                     55:         (
                     56:             [storage:ArrayObject:private] => test Object
                     57:                 (
                     58:                     [pub] => public
                     59:                     [pro:protected] => protected
                     60:                     [pri:test:private] => private
                     61:                     [imp] => implicit
                     62:                     [dyn] => dynamic
                     63:                 )
                     64: 
                     65:         )
                     66: 
                     67: )
                     68: pub => public
                     69: imp => implicit
                     70: dyn => dynamic
                     71: ===DONE===

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