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

1.1       misho       1: --TEST--
                      2: ReflectionObject::getConstant() 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->getConstant('a'));
                     23:        var_dump($rc->getConstant('doesntexist'));
                     24: }
                     25: ?>
                     26: --EXPECTF--
                     27: Reflecting on instance of class C: 
                     28: string(12) "hello from C"
                     29: bool(false)
                     30: Reflecting on instance of class D: 
                     31: string(12) "hello from C"
                     32: bool(false)
                     33: Reflecting on instance of class E: 
                     34: string(12) "hello from C"
                     35: bool(false)
                     36: Reflecting on instance of class F: 
                     37: string(12) "hello from F"
                     38: bool(false)
                     39: Reflecting on instance of class X: 
                     40: bool(false)
                     41: bool(false)

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