Annotation of embedaddon/php/ext/reflection/tests/ReflectionProperty_isDefault_basic.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test ReflectionProperty::isDefault() usage.
! 3: --FILE--
! 4: <?php
! 5:
! 6: function reflectProperty($class, $property) {
! 7: $propInfo = new ReflectionProperty($class, $property);
! 8: echo "**********************************\n";
! 9: echo "Reflecting on property $class::$property\n\n";
! 10: echo "isDefault():\n";
! 11: var_dump($propInfo->isDefault());
! 12: echo "\n**********************************\n";
! 13: }
! 14:
! 15: class TestClass {
! 16: public $pub;
! 17: static public $stat = "static property";
! 18: protected $prot = 4;
! 19: private $priv = "keepOut";
! 20: }
! 21:
! 22: reflectProperty("TestClass", "pub");
! 23: reflectProperty("TestClass", "stat");
! 24: reflectProperty("TestClass", "prot");
! 25: reflectProperty("TestClass", "priv");
! 26:
! 27: echo "Wrong number of params:\n";
! 28: $propInfo = new ReflectionProperty('TestClass', 'pub');
! 29: $propInfo->isDefault(1);
! 30:
! 31: ?>
! 32: --EXPECTF--
! 33: **********************************
! 34: Reflecting on property TestClass::pub
! 35:
! 36: isDefault():
! 37: bool(true)
! 38:
! 39: **********************************
! 40: **********************************
! 41: Reflecting on property TestClass::stat
! 42:
! 43: isDefault():
! 44: bool(true)
! 45:
! 46: **********************************
! 47: **********************************
! 48: Reflecting on property TestClass::prot
! 49:
! 50: isDefault():
! 51: bool(true)
! 52:
! 53: **********************************
! 54: **********************************
! 55: Reflecting on property TestClass::priv
! 56:
! 57: isDefault():
! 58: bool(true)
! 59:
! 60: **********************************
! 61: Wrong number of params:
! 62:
! 63: Warning: ReflectionProperty::isDefault() expects exactly 0 parameters, 1 given in %s on line %d
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>