Annotation of embedaddon/php/ext/reflection/tests/ReflectionMethod_basic1.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: ReflectionMethod class - various methods
! 3: --FILE--
! 4: <?php
! 5:
! 6: function reflectMethod($class, $method) {
! 7: $methodInfo = new ReflectionMethod($class, $method);
! 8: echo "**********************************\n";
! 9: echo "Reflecting on method $class::$method()\n\n";
! 10: echo "\nisFinal():\n";
! 11: var_dump($methodInfo->isFinal());
! 12: echo "\nisAbstract():\n";
! 13: var_dump($methodInfo->isAbstract());
! 14: echo "\nisPublic():\n";
! 15: var_dump($methodInfo->isPublic());
! 16: echo "\nisPrivate():\n";
! 17: var_dump($methodInfo->isPrivate());
! 18: echo "\nisProtected():\n";
! 19: var_dump($methodInfo->isProtected());
! 20: echo "\nisStatic():\n";
! 21: var_dump($methodInfo->isStatic());
! 22: echo "\nisConstructor():\n";
! 23: var_dump($methodInfo->isConstructor());
! 24: echo "\nisDestructor():\n";
! 25: var_dump($methodInfo->isDestructor());
! 26: echo "\n**********************************\n";
! 27: }
! 28:
! 29: class TestClass
! 30: {
! 31: public function foo() {
! 32: echo "Called foo()\n";
! 33: }
! 34:
! 35: static function stat() {
! 36: echo "Called stat()\n";
! 37: }
! 38:
! 39: private function priv() {
! 40: echo "Called priv()\n";
! 41: }
! 42:
! 43: protected function prot() {}
! 44:
! 45: public function __destruct() {}
! 46: }
! 47:
! 48: class DerivedClass extends TestClass {}
! 49:
! 50: interface TestInterface {
! 51: public function int();
! 52: }
! 53:
! 54: reflectMethod("DerivedClass", "foo");
! 55: reflectMethod("TestClass", "stat");
! 56: reflectMethod("TestClass", "priv");
! 57: reflectMethod("TestClass", "prot");
! 58: reflectMethod("DerivedClass", "prot");
! 59: reflectMethod("TestInterface", "int");
! 60: reflectMethod("ReflectionProperty", "__construct");
! 61: reflectMethod("TestClass", "__destruct");
! 62:
! 63: ?>
! 64: --EXPECT--
! 65: **********************************
! 66: Reflecting on method DerivedClass::foo()
! 67:
! 68:
! 69: isFinal():
! 70: bool(false)
! 71:
! 72: isAbstract():
! 73: bool(false)
! 74:
! 75: isPublic():
! 76: bool(true)
! 77:
! 78: isPrivate():
! 79: bool(false)
! 80:
! 81: isProtected():
! 82: bool(false)
! 83:
! 84: isStatic():
! 85: bool(false)
! 86:
! 87: isConstructor():
! 88: bool(false)
! 89:
! 90: isDestructor():
! 91: bool(false)
! 92:
! 93: **********************************
! 94: **********************************
! 95: Reflecting on method TestClass::stat()
! 96:
! 97:
! 98: isFinal():
! 99: bool(false)
! 100:
! 101: isAbstract():
! 102: bool(false)
! 103:
! 104: isPublic():
! 105: bool(true)
! 106:
! 107: isPrivate():
! 108: bool(false)
! 109:
! 110: isProtected():
! 111: bool(false)
! 112:
! 113: isStatic():
! 114: bool(true)
! 115:
! 116: isConstructor():
! 117: bool(false)
! 118:
! 119: isDestructor():
! 120: bool(false)
! 121:
! 122: **********************************
! 123: **********************************
! 124: Reflecting on method TestClass::priv()
! 125:
! 126:
! 127: isFinal():
! 128: bool(false)
! 129:
! 130: isAbstract():
! 131: bool(false)
! 132:
! 133: isPublic():
! 134: bool(false)
! 135:
! 136: isPrivate():
! 137: bool(true)
! 138:
! 139: isProtected():
! 140: bool(false)
! 141:
! 142: isStatic():
! 143: bool(false)
! 144:
! 145: isConstructor():
! 146: bool(false)
! 147:
! 148: isDestructor():
! 149: bool(false)
! 150:
! 151: **********************************
! 152: **********************************
! 153: Reflecting on method TestClass::prot()
! 154:
! 155:
! 156: isFinal():
! 157: bool(false)
! 158:
! 159: isAbstract():
! 160: bool(false)
! 161:
! 162: isPublic():
! 163: bool(false)
! 164:
! 165: isPrivate():
! 166: bool(false)
! 167:
! 168: isProtected():
! 169: bool(true)
! 170:
! 171: isStatic():
! 172: bool(false)
! 173:
! 174: isConstructor():
! 175: bool(false)
! 176:
! 177: isDestructor():
! 178: bool(false)
! 179:
! 180: **********************************
! 181: **********************************
! 182: Reflecting on method DerivedClass::prot()
! 183:
! 184:
! 185: isFinal():
! 186: bool(false)
! 187:
! 188: isAbstract():
! 189: bool(false)
! 190:
! 191: isPublic():
! 192: bool(false)
! 193:
! 194: isPrivate():
! 195: bool(false)
! 196:
! 197: isProtected():
! 198: bool(true)
! 199:
! 200: isStatic():
! 201: bool(false)
! 202:
! 203: isConstructor():
! 204: bool(false)
! 205:
! 206: isDestructor():
! 207: bool(false)
! 208:
! 209: **********************************
! 210: **********************************
! 211: Reflecting on method TestInterface::int()
! 212:
! 213:
! 214: isFinal():
! 215: bool(false)
! 216:
! 217: isAbstract():
! 218: bool(true)
! 219:
! 220: isPublic():
! 221: bool(true)
! 222:
! 223: isPrivate():
! 224: bool(false)
! 225:
! 226: isProtected():
! 227: bool(false)
! 228:
! 229: isStatic():
! 230: bool(false)
! 231:
! 232: isConstructor():
! 233: bool(false)
! 234:
! 235: isDestructor():
! 236: bool(false)
! 237:
! 238: **********************************
! 239: **********************************
! 240: Reflecting on method ReflectionProperty::__construct()
! 241:
! 242:
! 243: isFinal():
! 244: bool(false)
! 245:
! 246: isAbstract():
! 247: bool(false)
! 248:
! 249: isPublic():
! 250: bool(true)
! 251:
! 252: isPrivate():
! 253: bool(false)
! 254:
! 255: isProtected():
! 256: bool(false)
! 257:
! 258: isStatic():
! 259: bool(false)
! 260:
! 261: isConstructor():
! 262: bool(true)
! 263:
! 264: isDestructor():
! 265: bool(false)
! 266:
! 267: **********************************
! 268: **********************************
! 269: Reflecting on method TestClass::__destruct()
! 270:
! 271:
! 272: isFinal():
! 273: bool(false)
! 274:
! 275: isAbstract():
! 276: bool(false)
! 277:
! 278: isPublic():
! 279: bool(true)
! 280:
! 281: isPrivate():
! 282: bool(false)
! 283:
! 284: isProtected():
! 285: bool(false)
! 286:
! 287: isStatic():
! 288: bool(false)
! 289:
! 290: isConstructor():
! 291: bool(false)
! 292:
! 293: isDestructor():
! 294: bool(true)
! 295:
! 296: **********************************
! 297:
! 298:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>