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

1.1       misho       1: --TEST--
                      2: SPL: SplObjectStorage serialization
                      3: --FILE--
                      4: <?php
                      5: 
                      6: class TestClass
                      7: {
                      8:        public $test = 25;
                      9:        
                     10:        public function __construct($test = 42)
                     11:        {
                     12:                $this->test = $test;
                     13:        }
                     14: }
                     15: 
                     16: $storage = new SplObjectStorage();
                     17: 
                     18: foreach(array(1,"2","foo",true) as $value)
                     19: {
                     20:      $storage->attach(new TestClass($value));
                     21: }
                     22: 
                     23: var_dump(count($storage));
                     24: 
                     25: foreach($storage as $object)
                     26: {
                     27:        var_dump($object->test);
                     28: }
                     29: 
                     30: var_dump(serialize($storage));
                     31: echo "===UNSERIALIZE===\n";
                     32: 
                     33: $storage2 = unserialize(serialize($storage));
                     34: 
                     35: var_dump(count($storage2));
                     36: 
                     37: foreach($storage2 as $object)
                     38: {
                     39:        var_dump($object->test);
                     40: }
                     41: 
                     42: ?>
                     43: ===DONE===
                     44: <?php exit(0); ?>
                     45: --EXPECTF--
                     46: int(4)
                     47: int(1)
                     48: string(1) "2"
                     49: string(3) "foo"
                     50: bool(true)
                     51: string(%d) "%s"
                     52: ===UNSERIALIZE===
                     53: int(4)
                     54: int(1)
                     55: string(1) "2"
                     56: string(3) "foo"
                     57: bool(true)
                     58: ===DONE===

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