Annotation of embedaddon/php/ext/reflection/tests/ReflectionClass_hasConstant_001.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: ReflectionClass::hasConstant()
! 3: --CREDITS--
! 4: Robin Fernandes <robinf@php.net>
! 5: Steve Seear <stevseea@php.net>
! 6: --FILE--
! 7: <?php
! 8: class C {
! 9: const myConst = 1;
! 10: }
! 11:
! 12: class D extends C {
! 13: }
! 14:
! 15:
! 16: $rc = new ReflectionClass("C");
! 17: echo "Check existing constant: ";
! 18: var_dump($rc->hasConstant("myConst"));
! 19: echo "Check existing constant, different case: ";
! 20: var_dump($rc->hasConstant("MyCoNsT"));
! 21: echo "Check absent constant: ";
! 22: var_dump($rc->hasConstant("doesntExist"));
! 23:
! 24:
! 25: $rd = new ReflectionClass("D");
! 26: echo "Check inherited constant: ";
! 27: var_dump($rd->hasConstant("myConst"));
! 28: echo "Check absent constant: ";
! 29: var_dump($rd->hasConstant("doesntExist"));
! 30: ?>
! 31: --EXPECTF--
! 32: Check existing constant: bool(true)
! 33: Check existing constant, different case: bool(false)
! 34: Check absent constant: bool(false)
! 35: Check inherited constant: bool(true)
! 36: Check absent constant: bool(false)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>