]> granicus.if.org Git - php/commitdiff
Add test for ReflectionMethod::getPrototype_basic()
authormarcosptf <marcosptf@yahoo.com.br>
Tue, 25 Aug 2015 04:22:42 +0000 (01:22 -0300)
committerChristoph M. Becker <cmb@php.net>
Tue, 1 Sep 2015 22:28:46 +0000 (00:28 +0200)
ext/reflection/tests/ReflectionMethod_getPrototype_basic.phpt [new file with mode: 0644]

diff --git a/ext/reflection/tests/ReflectionMethod_getPrototype_basic.phpt b/ext/reflection/tests/ReflectionMethod_getPrototype_basic.phpt
new file mode 100644 (file)
index 0000000..c57a529
--- /dev/null
@@ -0,0 +1,29 @@
+--TEST--
+public ReflectionMethod ReflectionMethod::getPrototype ( void );
+--CREDITS--
+marcosptf - <marcosptf@yahoo.com.br>
+--FILE--
+<?php
+class Hello {
+    public function sayHelloTo($name) {
+        return 'Hello ' . $name;
+    }
+}
+
+class HelloWorld extends Hello {
+    public function sayHelloTo($name) {
+        return 'Hello world: ' . $name;
+    }
+}
+
+$reflectionMethod = new ReflectionMethod('HelloWorld', 'sayHelloTo');
+var_dump($reflectionMethod->getPrototype());
+
+?>
+--EXPECT--
+object(ReflectionMethod)#2 (2) {
+  ["name"]=>
+  string(10) "sayHelloTo"
+  ["class"]=>
+  string(5) "Hello"
+}