1--TEST--
2ReflectionMethod constructor errors
3--CREDITS--
4Robin Fernandes <robinf@php.net>
5Steve Seear <stevseea@php.net>
6--FILE--
7<?php
8
9class TestClass
10{
11    public function foo() {
12    }
13}
14
15
16try {
17	echo "Too few arguments:\n";
18	$methodInfo = new ReflectionMethod();
19} catch (TypeError $re) {
20	echo "Ok - ".$re->getMessage().PHP_EOL;
21}
22try {
23	echo "\nToo many arguments:\n";
24	$methodInfo = new ReflectionMethod("TestClass", "foo", true);
25} catch (TypeError $re) {
26	echo "Ok - ".$re->getMessage().PHP_EOL;
27}
28
29
30try {
31	//invalid class
32	$methodInfo = new ReflectionMethod("InvalidClassName", "foo");
33} catch (ReflectionException $re) {
34	echo "Ok - ".$re->getMessage().PHP_EOL;
35}
36
37
38try {
39	//invalid 1st param
40	$methodInfo = new ReflectionMethod([], "foo");
41} catch (ReflectionException $re) {
42	echo "Ok - ".$re->getMessage().PHP_EOL;
43}
44
45try{
46	//invalid 2nd param
47	$methodInfo = new ReflectionMethod("TestClass", []);
48} catch (TypeError $re) {
49	echo "Ok - ".$re->getMessage().PHP_EOL;
50}
51
52?>
53--EXPECT--
54Too few arguments:
55Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 0 given
56
57Too many arguments:
58Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 3 given
59Ok - Class InvalidClassName does not exist
60Ok - The parameter class is expected to be either a string or an object
61Ok - ReflectionMethod::__construct() expects exactly 1 parameter, 2 given
62