Annotation of embedaddon/php/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: ReflectionMethod constructor errors
! 3: --CREDITS--
! 4: Robin Fernandes <robinf@php.net>
! 5: Steve Seear <stevseea@php.net>
! 6: --FILE--
! 7: <?php
! 8:
! 9: class TestClass
! 10: {
! 11: public function foo() {
! 12: }
! 13: }
! 14:
! 15:
! 16: try {
! 17: echo "\nWrong type of argument (bool):\n";
! 18: $methodInfo = new ReflectionMethod(true);
! 19: } catch (Exception $e) {
! 20: print $e->__toString();
! 21: }
! 22: try {
! 23: echo "\nWrong type of argument (int):\n";
! 24: $methodInfo = new ReflectionMethod(3);
! 25: } catch (Exception $e) {
! 26: print $e->__toString();
! 27: }
! 28: try {
! 29: echo "\nWrong type of argument (bool, string):\n";
! 30: $methodInfo = new ReflectionMethod(true, "foo");
! 31: } catch (Exception $e) {
! 32: print $e->__toString();
! 33: }
! 34: try {
! 35: echo "\nWrong type of argument (string, bool):\n";
! 36: $methodInfo = new ReflectionMethod('TestClass', true);
! 37: } catch (Exception $e) {
! 38: print $e->__toString();
! 39: }
! 40: try {
! 41: echo "\nNo method given:\n";
! 42: $methodInfo = new ReflectionMethod("TestClass");
! 43: } catch (Exception $e) {
! 44: print $e->__toString();
! 45: }
! 46: try {
! 47: echo "\nClass and Method in same string, bad method name:\n";
! 48: $methodInfo = new ReflectionMethod("TestClass::foop::dedoop");
! 49: } catch (Exception $e) {
! 50: print $e->__toString();
! 51: }
! 52: try {
! 53: echo "\nClass and Method in same string, bad class name:\n";
! 54: $methodInfo = new ReflectionMethod("TestCla::foo");
! 55: } catch (Exception $e) {
! 56: print $e->__toString();
! 57: }
! 58: try {
! 59: echo "\nClass and Method in same string (ok):\n";
! 60: $methodInfo = new ReflectionMethod("TestClass::foo");
! 61: } catch (Exception $e) {
! 62: print $e->__toString();
! 63: }
! 64:
! 65: ?>
! 66: --EXPECTF--
! 67: Wrong type of argument (bool):
! 68: exception 'ReflectionException' with message 'Invalid method name 1' in %s
! 69: Stack trace:
! 70: #0 %s ReflectionMethod->__construct('1')
! 71: #1 {main}
! 72: Wrong type of argument (int):
! 73: exception 'ReflectionException' with message 'Invalid method name 3' in %s
! 74: Stack trace:
! 75: #0 %s ReflectionMethod->__construct('3')
! 76: #1 {main}
! 77: Wrong type of argument (bool, string):
! 78: exception 'ReflectionException' with message 'The parameter class is expected to be either a string or an object' in %s
! 79: Stack trace:
! 80: #0 %s ReflectionMethod->__construct(true, 'foo')
! 81: #1 {main}
! 82: Wrong type of argument (string, bool):
! 83: exception 'ReflectionException' with message 'Method TestClass::1() does not exist' in %s
! 84: Stack trace:
! 85: #0 %s ReflectionMethod->__construct('TestClass', '1')
! 86: #1 {main}
! 87: No method given:
! 88: exception 'ReflectionException' with message 'Invalid method name TestClass' in %s
! 89: Stack trace:
! 90: #0 %s ReflectionMethod->__construct('TestClass')
! 91: #1 {main}
! 92: Class and Method in same string, bad method name:
! 93: exception 'ReflectionException' with message 'Method TestClass::foop::dedoop() does not exist' in %s
! 94: Stack trace:
! 95: #0 %s ReflectionMethod->__construct('TestClass::foop...')
! 96: #1 {main}
! 97: Class and Method in same string, bad class name:
! 98: exception 'ReflectionException' with message 'Class TestCla does not exist' in %s
! 99: Stack trace:
! 100: #0 %s ReflectionMethod->__construct('TestCla::foo')
! 101: #1 {main}
! 102: Class and Method in same string (ok):
! 103:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>