xref: /PHP-7.4/ext/reflection/tests/008.phpt (revision 782352c5)
1--TEST--
2ReflectionMethod::__construct() tests
3--FILE--
4<?php
5
6$a = array("", 1, "::", "a::", "::b", "a::b");
7
8foreach ($a as $val) {
9	try {
10		new ReflectionMethod($val);
11	} catch (Exception $e) {
12		var_dump($e->getMessage());
13	}
14}
15
16$a = array("", 1, "");
17$b = array("", "", 1);
18
19foreach ($a as $key=>$val) {
20	try {
21		new ReflectionMethod($val, $b[$key]);
22	} catch (Exception $e) {
23		var_dump($e->getMessage());
24	}
25}
26
27echo "Done\n";
28?>
29--EXPECT--
30string(20) "Invalid method name "
31string(21) "Invalid method name 1"
32string(21) "Class  does not exist"
33string(22) "Class a does not exist"
34string(21) "Class  does not exist"
35string(22) "Class a does not exist"
36string(21) "Class  does not exist"
37string(66) "The parameter class is expected to be either a string or an object"
38string(21) "Class  does not exist"
39Done
40