@@ -60,15 +60,21 @@ test(function () {
60
60
test (function () {
61
61
$ method = new ReflectionMethod ('MyPresenter ' , 'hints ' );
62
62
63
- Assert::same ([0 , FALSE , '' , []], Reflection::combineArgs ($ method , []));
64
- Assert::same ([0 , FALSE , '' , []], Reflection::combineArgs ($ method , ['int ' => NULL , 'bool ' => NULL , 'str ' => NULL , 'arr ' => NULL ]));
65
63
Assert::same ([1 , TRUE , 'abc ' , [1 ]], Reflection::combineArgs ($ method , ['int ' => '1 ' , 'bool ' => '1 ' , 'str ' => 'abc ' , 'arr ' => [1 ]]));
66
- Assert::same ([0 , FALSE , '' , []], Reflection::combineArgs ($ method , ['int ' => 0 , 'bool ' => FALSE , 'str ' => '' , 'arr ' => []]));
64
+ Assert::same ([0 , FALSE , '' , []], Reflection::combineArgs ($ method , ['int ' => 0 , 'bool ' => FALSE , 'str ' => '' ])); // missing 'arr'
65
+
66
+ Assert::exception (function () use ($ method ) {
67
+ Reflection::combineArgs ($ method , []);
68
+ }, BadRequestException::class, 'Missing parameter $int required by MyPresenter::hints() ' );
67
69
68
70
Assert::exception (function () use ($ method ) {
69
71
Reflection::combineArgs ($ method , ['int ' => '' ]);
70
72
}, BadRequestException::class, 'Argument $int passed to MyPresenter::hints() must be int, string given. ' );
71
73
74
+ Assert::exception (function () use ($ method ) {
75
+ Reflection::combineArgs ($ method , ['int ' => NULL ]);
76
+ }, BadRequestException::class, 'Missing parameter $int required by MyPresenter::hints() ' );
77
+
72
78
Assert::exception (function () use ($ method ) {
73
79
Reflection::combineArgs ($ method , ['int ' => new stdClass ]);
74
80
}, BadRequestException::class, 'Argument $int passed to MyPresenter::hints() must be int, stdClass given. ' );
@@ -184,11 +190,11 @@ test(function () {
184
190
185
191
Assert::exception (function () use ($ method ) {
186
192
Reflection::combineArgs ($ method , []);
187
- }, BadRequestException::class, 'Argument $req passed to MyPresenter::objects() must be stdClass, NULL given. ' );
193
+ }, BadRequestException::class, 'Missing parameter $req required by MyPresenter::objects() ' );
188
194
189
195
Assert::exception (function () use ($ method ) {
190
196
Reflection::combineArgs ($ method , ['req ' => NULL , 'opt ' => NULL ]);
191
- }, BadRequestException::class, 'Argument $req passed to MyPresenter::objects() must be stdClass, NULL given. ' );
197
+ }, BadRequestException::class, 'Missing parameter $req required by MyPresenter::objects() ' );
192
198
193
199
Assert::exception (function () use ($ method ) {
194
200
Reflection::combineArgs ($ method , ['req ' => $ method , 'opt ' => NULL ]);
0 commit comments