Annotation of embedaddon/php/ext/reflection/tests/ReflectionClass_getConstants_basic.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: ReflectionClass::getConstants()
        !             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 "Constants from class $class: \n";
        !            21:        $rc = new ReflectionClass($class);
        !            22:        var_dump($rc->getConstants());
        !            23: }
        !            24: ?>
        !            25: --EXPECTF--
        !            26: Constants from class C: 
        !            27: array(1) {
        !            28:   ["a"]=>
        !            29:   string(12) "hello from C"
        !            30: }
        !            31: Constants from class D: 
        !            32: array(1) {
        !            33:   ["a"]=>
        !            34:   string(12) "hello from C"
        !            35: }
        !            36: Constants from class E: 
        !            37: array(1) {
        !            38:   ["a"]=>
        !            39:   string(12) "hello from C"
        !            40: }
        !            41: Constants from class F: 
        !            42: array(1) {
        !            43:   ["a"]=>
        !            44:   string(12) "hello from F"
        !            45: }
        !            46: Constants from class X: 
        !            47: array(0) {
        !            48: }

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