Annotation of embedaddon/php/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: ReflectionObject::getConstructor() - basic function test
                      3: --FILE--
                      4: <?php
                      5: class NewCtor {
                      6:        function __construct() {}
                      7: }
                      8: 
                      9: class ExtendsNewCtor extends NewCtor {
                     10: }
                     11: 
                     12: class OldCtor {
                     13:        function OldCtor() {}
                     14: }
                     15: 
                     16: class ExtendsOldCtor extends OldCtor {
                     17: }
                     18: 
                     19: 
                     20: class X {
                     21:        function Y() {}
                     22: }
                     23: 
                     24: class Y extends X {
                     25: }
                     26: 
                     27: class OldAndNewCtor {
                     28:        function OldAndNewCtor() {}
                     29:        function __construct() {}
                     30: }
                     31: 
                     32: class NewAndOldCtor {
                     33:        function __construct() {}
                     34:        function NewAndOldCtor() {}
                     35: }
                     36: class B {
                     37:        function B() {}
                     38: }
                     39: 
                     40: class C extends B {
                     41:        function C() {}
                     42: }
                     43: 
                     44: class D1 extends C {
                     45:        function __construct() {}
                     46: }
                     47: 
                     48: class D2 extends C {
                     49: }
                     50: 
                     51: $classes = array('NewCtor', 'ExtendsNewCtor', 'OldCtor', 'ExtendsOldCtor', 
                     52:                                 'OldAndNewCtor', 'NewAndOldCtor', 'B', 'C', 'D1', 'D2', 'X', 'Y');
                     53: 
                     54: foreach ($classes as $class) {
                     55:        $rc = new ReflectionObject(new $class);
                     56:        $rm = $rc->getConstructor();
                     57:        if ($rm != null) {
                     58:                echo "Constructor of $class: " . $rm->getName() . "\n";
                     59:        }  else {
                     60:                echo "No constructor for $class\n";
                     61:        }
                     62:        
                     63: }                               
                     64:                                
                     65: ?>
                     66: --EXPECTF--
                     67: Strict Standards: Redefining already defined constructor for class OldAndNewCtor in %s on line %d
                     68: Constructor of NewCtor: __construct
                     69: Constructor of ExtendsNewCtor: __construct
                     70: Constructor of OldCtor: OldCtor
                     71: Constructor of ExtendsOldCtor: OldCtor
                     72: Constructor of OldAndNewCtor: __construct
                     73: Constructor of NewAndOldCtor: __construct
                     74: Constructor of B: B
                     75: Constructor of C: C
                     76: Constructor of D1: __construct
                     77: Constructor of D2: C
                     78: No constructor for X
                     79: No constructor for Y

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