Annotation of embedaddon/php/ext/reflection/tests/ReflectionMethod_basic4.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: ReflectionMethod class getFileName(), getStartLine() and getEndLine() 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 "\ngetFileName():\n";
        !            11:     var_dump($methodInfo->getFileName());
        !            12:     echo "\ngetStartLine():\n";
        !            13:     var_dump($methodInfo->getStartLine());
        !            14:     echo "\ngetEndLine():\n";
        !            15:     var_dump($methodInfo->getEndLine());
        !            16:     echo "\n**********************************\n";
        !            17: }
        !            18: 
        !            19: class TestClass
        !            20: {
        !            21:     public function foo() {
        !            22: 
        !            23: 
        !            24:         echo "Called foo()\n";
        !            25: 
        !            26: 
        !            27:     }
        !            28: 
        !            29:     static function stat() {
        !            30:         echo "Called stat()\n";
        !            31:     }
        !            32: 
        !            33:     private function priv() {
        !            34:         echo "Called priv()\n";
        !            35:     }
        !            36: 
        !            37:     protected function prot() {}
        !            38: 
        !            39:     public function __destruct() {}
        !            40: }
        !            41: 
        !            42: class DerivedClass extends TestClass {}
        !            43: 
        !            44: interface TestInterface {
        !            45:     public function int();
        !            46: }
        !            47: 
        !            48: reflectMethod("DerivedClass", "foo");
        !            49: reflectMethod("TestClass", "stat");
        !            50: reflectMethod("TestClass", "priv");
        !            51: reflectMethod("TestClass", "prot");
        !            52: reflectMethod("DerivedClass", "prot");
        !            53: reflectMethod("TestInterface", "int");
        !            54: reflectMethod("ReflectionProperty", "__construct");
        !            55: reflectMethod("TestClass", "__destruct");
        !            56: 
        !            57: ?>
        !            58: --EXPECTF--
        !            59: **********************************
        !            60: Reflecting on method DerivedClass::foo()
        !            61: 
        !            62: 
        !            63: getFileName():
        !            64: string(%d) "%sReflectionMethod_basic4.php"
        !            65: 
        !            66: getStartLine():
        !            67: int(18)
        !            68: 
        !            69: getEndLine():
        !            70: int(24)
        !            71: 
        !            72: **********************************
        !            73: **********************************
        !            74: Reflecting on method TestClass::stat()
        !            75: 
        !            76: 
        !            77: getFileName():
        !            78: string(%d) "%sReflectionMethod_basic4.php"
        !            79: 
        !            80: getStartLine():
        !            81: int(26)
        !            82: 
        !            83: getEndLine():
        !            84: int(28)
        !            85: 
        !            86: **********************************
        !            87: **********************************
        !            88: Reflecting on method TestClass::priv()
        !            89: 
        !            90: 
        !            91: getFileName():
        !            92: string(%d) "%sReflectionMethod_basic4.php"
        !            93: 
        !            94: getStartLine():
        !            95: int(30)
        !            96: 
        !            97: getEndLine():
        !            98: int(32)
        !            99: 
        !           100: **********************************
        !           101: **********************************
        !           102: Reflecting on method TestClass::prot()
        !           103: 
        !           104: 
        !           105: getFileName():
        !           106: string(%d) "%sReflectionMethod_basic4.php"
        !           107: 
        !           108: getStartLine():
        !           109: int(34)
        !           110: 
        !           111: getEndLine():
        !           112: int(34)
        !           113: 
        !           114: **********************************
        !           115: **********************************
        !           116: Reflecting on method DerivedClass::prot()
        !           117: 
        !           118: 
        !           119: getFileName():
        !           120: string(%d) "%sReflectionMethod_basic4.php"
        !           121: 
        !           122: getStartLine():
        !           123: int(34)
        !           124: 
        !           125: getEndLine():
        !           126: int(34)
        !           127: 
        !           128: **********************************
        !           129: **********************************
        !           130: Reflecting on method TestInterface::int()
        !           131: 
        !           132: 
        !           133: getFileName():
        !           134: string(%d) "%sReflectionMethod_basic4.php"
        !           135: 
        !           136: getStartLine():
        !           137: int(42)
        !           138: 
        !           139: getEndLine():
        !           140: int(42)
        !           141: 
        !           142: **********************************
        !           143: **********************************
        !           144: Reflecting on method ReflectionProperty::__construct()
        !           145: 
        !           146: 
        !           147: getFileName():
        !           148: bool(false)
        !           149: 
        !           150: getStartLine():
        !           151: bool(false)
        !           152: 
        !           153: getEndLine():
        !           154: bool(false)
        !           155: 
        !           156: **********************************
        !           157: **********************************
        !           158: Reflecting on method TestClass::__destruct()
        !           159: 
        !           160: 
        !           161: getFileName():
        !           162: string(%d) "%sReflectionMethod_basic4.php"
        !           163: 
        !           164: getStartLine():
        !           165: int(36)
        !           166: 
        !           167: getEndLine():
        !           168: int(36)
        !           169: 
        !           170: **********************************

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>