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

1.1       misho       1: --TEST--
                      2: ReflectionObject::getConstants() - basic function test 
                      3: --FILE--
                      4: <?php
                      5: class C {
                      6:        const a = 'hello from C';
                      7: }
                      8: class D extends C {
                      9: }
                     10: class E extends D {
                     11: }
                     12: class F extends E {
                     13:        const a = 'hello from F';
                     14: }
                     15: class X {
                     16: }
                     17: 
                     18: $classes = array("C", "D", "E", "F", "X");
                     19: foreach($classes as $class) {
                     20:        echo "Reflecting on instance of class $class: \n";
                     21:        $rc = new ReflectionObject(new $class);
                     22:        var_dump($rc->getConstants());
                     23: }
                     24: 
                     25: ?>
                     26: --EXPECTF--
                     27: Reflecting on instance of class C: 
                     28: array(1) {
                     29:   ["a"]=>
                     30:   string(12) "hello from C"
                     31: }
                     32: Reflecting on instance of class D: 
                     33: array(1) {
                     34:   ["a"]=>
                     35:   string(12) "hello from C"
                     36: }
                     37: Reflecting on instance of class E: 
                     38: array(1) {
                     39:   ["a"]=>
                     40:   string(12) "hello from C"
                     41: }
                     42: Reflecting on instance of class F: 
                     43: array(1) {
                     44:   ["a"]=>
                     45:   string(12) "hello from F"
                     46: }
                     47: Reflecting on instance of class X: 
                     48: array(0) {
                     49: }

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