Skip to content

Commit f7ef278

Browse files
committed
test: add test values with various types
1 parent 5f2cdd2 commit f7ef278

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

tests/system/Test/FeatureTestTraitTest.php

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,19 @@ public function testCallWithJsonRequest()
421421
'\Tests\Support\Controllers\Popcorn::echoJson',
422422
],
423423
]);
424-
$response = $this->withBodyFormat('json')->call('post', 'home', ['foo' => 'bar']);
424+
$data = [
425+
'true' => true,
426+
'false' => false,
427+
'int' => 2,
428+
'null' => null,
429+
'float' => 1.23,
430+
'string' => 'foo',
431+
];
432+
$response = $this->withBodyFormat('json')
433+
->call('post', 'home', $data);
434+
425435
$response->assertOK();
426-
$response->assertJSONExact(['foo' => 'bar']);
436+
$response->assertJSONExact($data);
427437
}
428438

429439
public function testSetupRequestBodyWithParams()
@@ -440,10 +450,18 @@ public function testSetupRequestBodyWithXml()
440450
{
441451
$request = $this->setupRequest('post', 'home');
442452

443-
$request = $this->withBodyFormat('xml')->setRequestBody($request, ['foo' => 'bar']);
453+
$data = [
454+
'true' => true,
455+
'false' => false,
456+
'int' => 2,
457+
'null' => null,
458+
'float' => 1.23,
459+
'string' => 'foo',
460+
];
461+
$request = $this->withBodyFormat('xml')->setRequestBody($request, $data);
444462

445463
$expectedXml = '<?xml version="1.0"?>
446-
<response><foo>bar</foo></response>
464+
<response><true>1</true><false/><int>2</int><null/><float>1.23</float><string>foo</string></response>
447465
';
448466

449467
$this->assertSame($expectedXml, $request->getBody());

0 commit comments

Comments
 (0)