xref: /PHP-8.0/ext/reflection/tests/008.phpt (revision a59923be)
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(90) "ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be a valid method name"
31string(90) "ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be a valid method name"
32string(23) "Class "" does not exist"
33string(24) "Class "a" does not exist"
34string(23) "Class "" does not exist"
35string(24) "Class "a" does not exist"
36string(23) "Class "" does not exist"
37string(24) "Class "1" does not exist"
38string(23) "Class "" does not exist"
39Done
40