Annotation of embedaddon/php/ext/reflection/tests/ReflectionClass_hasProperty_001.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: ReflectionClass::hasProperty()
! 3: --CREDITS--
! 4: Robin Fernandes <robinf@php.net>
! 5: Steve Seear <stevseea@php.net>
! 6: --FILE--
! 7: <?php
! 8: class pubf {
! 9: public $a;
! 10: static public $s;
! 11: }
! 12: class subpubf extends pubf {
! 13: }
! 14:
! 15: class protf {
! 16: protected $a;
! 17: static protected $s;
! 18: }
! 19: class subprotf extends protf {
! 20: }
! 21:
! 22: class privf {
! 23: private $a;
! 24: static protected $s;
! 25: }
! 26: class subprivf extends privf {
! 27: }
! 28:
! 29: $classes = array("pubf", "subpubf", "protf", "subprotf",
! 30: "privf", "subprivf");
! 31: foreach($classes as $class) {
! 32: echo "Reflecting on class $class: \n";
! 33: $rc = new ReflectionClass($class);
! 34: echo " --> Check for s: ";
! 35: var_dump($rc->hasProperty("s"));
! 36: echo " --> Check for a: ";
! 37: var_dump($rc->hasProperty("a"));
! 38: echo " --> Check for A: ";
! 39: var_dump($rc->hasProperty("A"));
! 40: echo " --> Check for doesntExist: ";
! 41: var_dump($rc->hasProperty("doesntExist"));
! 42: }
! 43: ?>
! 44: --EXPECTF--
! 45: Reflecting on class pubf:
! 46: --> Check for s: bool(true)
! 47: --> Check for a: bool(true)
! 48: --> Check for A: bool(false)
! 49: --> Check for doesntExist: bool(false)
! 50: Reflecting on class subpubf:
! 51: --> Check for s: bool(true)
! 52: --> Check for a: bool(true)
! 53: --> Check for A: bool(false)
! 54: --> Check for doesntExist: bool(false)
! 55: Reflecting on class protf:
! 56: --> Check for s: bool(true)
! 57: --> Check for a: bool(true)
! 58: --> Check for A: bool(false)
! 59: --> Check for doesntExist: bool(false)
! 60: Reflecting on class subprotf:
! 61: --> Check for s: bool(true)
! 62: --> Check for a: bool(true)
! 63: --> Check for A: bool(false)
! 64: --> Check for doesntExist: bool(false)
! 65: Reflecting on class privf:
! 66: --> Check for s: bool(true)
! 67: --> Check for a: bool(true)
! 68: --> Check for A: bool(false)
! 69: --> Check for doesntExist: bool(false)
! 70: Reflecting on class subprivf:
! 71: --> Check for s: bool(true)
! 72: --> Check for a: bool(false)
! 73: --> Check for A: bool(false)
! 74: --> Check for doesntExist: bool(false)
! 75:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>