Annotation of embedaddon/php/ext/reflection/tests/002.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Reflection properties are read only
! 3: --FILE--
! 4: <?php
! 5:
! 6: class ReflectionMethodEx extends ReflectionMethod
! 7: {
! 8: public $foo = "xyz";
! 9:
! 10: function __construct($c,$m)
! 11: {
! 12: echo __METHOD__ . "\n";
! 13: parent::__construct($c,$m);
! 14: }
! 15: }
! 16:
! 17: $r = new ReflectionMethodEx('ReflectionMethodEx','getName');
! 18:
! 19: var_dump($r->class);
! 20: var_dump($r->name);
! 21: var_dump($r->foo);
! 22: @var_dump($r->bar);
! 23:
! 24: try
! 25: {
! 26: $r->class = 'bullshit';
! 27: }
! 28: catch(ReflectionException $e)
! 29: {
! 30: echo $e->getMessage() . "\n";
! 31: }
! 32: try
! 33: {
! 34: $r->name = 'bullshit';
! 35: }
! 36: catch(ReflectionException $e)
! 37: {
! 38: echo $e->getMessage() . "\n";
! 39: }
! 40:
! 41: $r->foo = 'bar';
! 42: $r->bar = 'baz';
! 43:
! 44: var_dump($r->class);
! 45: var_dump($r->name);
! 46: var_dump($r->foo);
! 47: var_dump($r->bar);
! 48:
! 49: ?>
! 50: ===DONE===
! 51: --EXPECTF--
! 52: ReflectionMethodEx::__construct
! 53: %unicode|string%(26) "ReflectionFunctionAbstract"
! 54: %unicode|string%(7) "getName"
! 55: %unicode|string%(3) "xyz"
! 56: NULL
! 57: Cannot set read-only property ReflectionMethodEx::$class
! 58: Cannot set read-only property ReflectionMethodEx::$name
! 59: %unicode|string%(26) "ReflectionFunctionAbstract"
! 60: %unicode|string%(7) "getName"
! 61: %unicode|string%(3) "bar"
! 62: %unicode|string%(3) "baz"
! 63: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>