xref: /php-src/ext/reflection/tests/008.phpt (revision 688c6f37)
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    try {
16        ReflectionMethod::createFromMethodName($val);
17    } catch (Exception $e) {
18        var_dump($e->getMessage());
19    }
20}
21
22$a = array("", 1, "");
23$b = array("", "", 1);
24
25foreach ($a as $key=>$val) {
26    try {
27        new ReflectionMethod($val, $b[$key]);
28    } catch (Exception $e) {
29        var_dump($e->getMessage());
30    }
31}
32
33echo "Done\n";
34?>
35--EXPECTF--
36Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d
37string(90) "ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be a valid method name"
38string(91) "ReflectionMethod::createFromMethodName(): Argument #1 ($method) must be a valid method name"
39
40Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d
41string(90) "ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be a valid method name"
42string(91) "ReflectionMethod::createFromMethodName(): Argument #1 ($method) must be a valid method name"
43
44Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d
45string(23) "Class "" does not exist"
46string(23) "Class "" does not exist"
47
48Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d
49string(24) "Class "a" does not exist"
50string(24) "Class "a" does not exist"
51
52Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d
53string(23) "Class "" does not exist"
54string(23) "Class "" does not exist"
55
56Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d
57string(24) "Class "a" does not exist"
58string(24) "Class "a" does not exist"
59string(23) "Class "" does not exist"
60string(24) "Class "1" does not exist"
61string(23) "Class "" does not exist"
62Done
63