Annotation of embedaddon/php/ext/reflection/tests/ReflectionProperty_constructor_error.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test ReflectionProperty class constructor errors.
! 3: --FILE--
! 4: <?php
! 5:
! 6: class TestClass {
! 7: }
! 8:
! 9: $a = 5;
! 10:
! 11: echo "Non-existent class:\n";
! 12: try {
! 13: $propInfo = new ReflectionProperty("NonExistentClass", "prop");
! 14: }
! 15: catch(Exception $e) {
! 16: echo $e->getMessage();
! 17: }
! 18:
! 19: echo "\n\nWrong property parameter type:\n";
! 20: try {
! 21: $propInfo = new ReflectionProperty($a, 'TestClass');
! 22: }
! 23: catch(ReflectionException $e) {
! 24: echo $e->getMessage();
! 25: }
! 26:
! 27: echo "\n\nNon-existent property:\n";
! 28: try {
! 29: $propInfo = new ReflectionProperty('TestClass', "nonExistentProperty");
! 30: }
! 31: catch(Exception $e) {
! 32: echo $e->getMessage();
! 33: }
! 34:
! 35: ?>
! 36: --EXPECT--
! 37: Non-existent class:
! 38: Class NonExistentClass does not exist
! 39:
! 40: Wrong property parameter type:
! 41: The parameter class is expected to be either a string or an object
! 42:
! 43: Non-existent property:
! 44: Property TestClass::$nonExistentProperty does not exist
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>