Skip to content

Commit cf5f422

Browse files
author
yusuke nakazawa
committed
test: add withMultipleFormRequestParameters
1 parent 00ee45b commit cf5f422

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

tests/Fixtures/TestController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ public function withFormRequestParameter(TestRequest $request)
5757
return '';
5858
}
5959

60+
public function withMultipleFormRequestParameters(string $test, TestRequest $request)
61+
{
62+
return '';
63+
}
64+
6065
/**
6166
* @bodyParam direct_one string Is found directly on the method.
6267
*/

tests/Unit/GeneratorTestCase.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,48 @@ public function can_parse_form_request_body_parameters()
139139
], $bodyParameters);
140140
}
141141

142+
/** @test */
143+
public function can_parse_multiple_form_request_body_parameters()
144+
{
145+
$route = $this->createRoute('GET', '/api/test', 'withMultipleFormRequestParameters');
146+
$bodyParameters = $this->generator->processRoute($route)['bodyParameters'];
147+
148+
$this->assertArraySubset([
149+
'user_id' => [
150+
'type' => 'integer',
151+
'required' => true,
152+
'description' => 'The id of the user.',
153+
'value' => 9,
154+
],
155+
'room_id' => [
156+
'type' => 'string',
157+
'required' => false,
158+
'description' => 'The id of the room.',
159+
],
160+
'forever' => [
161+
'type' => 'boolean',
162+
'required' => false,
163+
'description' => 'Whether to ban the user forever.',
164+
'value' => false,
165+
],
166+
'another_one' => [
167+
'type' => 'number',
168+
'required' => false,
169+
'description' => 'Just need something here.',
170+
],
171+
'yet_another_param' => [
172+
'type' => 'object',
173+
'required' => true,
174+
'description' => '',
175+
],
176+
'even_more_param' => [
177+
'type' => 'array',
178+
'required' => false,
179+
'description' => '',
180+
],
181+
], $bodyParameters);
182+
}
183+
142184
/** @test */
143185
public function can_parse_query_parameters()
144186
{

0 commit comments

Comments
 (0)