xref: /PHP-5.4/ext/reflection/tests/004.phpt (revision 610c7fbe)
1--TEST--
2ReflectionMethod::invoke() with non object or null value
3--FILE--
4<?php
5
6class a {
7	function a(){
8	}
9}
10class b {
11}
12
13$b = new b();
14
15$a=new ReflectionClass("a");
16$m=$a->getMethod("a");
17
18try {
19        $m->invoke(null);
20} catch (ReflectionException $E) {
21        echo $E->getMessage()."\n";
22}
23
24
25try {
26        $m->invoke($b);
27} catch (ReflectionException $E) {
28        echo $E->getMessage()."\n";
29}
30
31$b = new a();
32try {
33        $m->invoke($b);
34} catch (ReflectionException $E) {
35        echo $E->getMessage()."\n";
36}
37
38echo "===DONE===\n";?>
39--EXPECT--
40Non-object passed to Invoke()
41Given object is not an instance of the class this method was declared in
42===DONE===
43