Annotation of embedaddon/php/ext/reflection/tests/ReflectionClass_getConstant_error.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: ReflectionClass::getConstant() - bad params
! 3: --FILE--
! 4: <?php
! 5: class C {
! 6: const myConst = 1;
! 7: }
! 8:
! 9: $rc = new ReflectionClass("C");
! 10: echo "Check invalid params:\n";
! 11: var_dump($rc->getConstant());
! 12: var_dump($rc->getConstant("myConst", "myConst"));
! 13: var_dump($rc->getConstant(null));
! 14: var_dump($rc->getConstant(1));
! 15: var_dump($rc->getConstant(1.5));
! 16: var_dump($rc->getConstant(true));
! 17: var_dump($rc->getConstant(array(1,2,3)));
! 18: var_dump($rc->getConstant(new C));
! 19: ?>
! 20: --EXPECTF--
! 21: Check invalid params:
! 22:
! 23: Warning: ReflectionClass::getConstant() expects exactly 1 parameter, 0 given in %s on line 8
! 24: NULL
! 25:
! 26: Warning: ReflectionClass::getConstant() expects exactly 1 parameter, 2 given in %s on line 9
! 27: NULL
! 28: bool(false)
! 29: bool(false)
! 30: bool(false)
! 31: bool(false)
! 32:
! 33: Warning: ReflectionClass::getConstant() expects parameter 1 to be string, array given in %s on line 14
! 34: NULL
! 35:
! 36: Warning: ReflectionClass::getConstant() expects parameter 1 to be string, object given in %s on line 15
! 37: NULL
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>