Skip to content

Commit feeb2d8

Browse files
committed
Tests: fixes
1 parent 8175e73 commit feeb2d8

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

tests/Cases/Core/Mapping/RequestEntityMapping.phpt

+10-8
Original file line numberDiff line numberDiff line change
@@ -88,20 +88,22 @@ test(function (): void {
8888
$request = new ApiRequest(Psr7ServerRequestFactory::fromSuperGlobal());
8989
$entity = new NotEmptyEntity();
9090

91-
$queryRequest = $request
92-
->withQueryParams(['foo' => 1]);
93-
94-
$bodyRequest = $request
95-
->withBody(Utils::streamFor(json_encode(['foo' => 1])));
96-
9791
foreach ([Endpoint::METHOD_GET, Endpoint::METHOD_DELETE, Endpoint::METHOD_HEAD] as $method) {
98-
$entity = $entity->fromRequest($queryRequest->withMethod($method));
92+
$queryRequest = $request
93+
->withQueryParams(['foo' => 1])
94+
->withMethod($method);
95+
96+
$entity = $entity->fromRequest($queryRequest);
9997

10098
Assert::same(1, $entity->foo);
10199
}
102100

103101
foreach ([Endpoint::METHOD_POST, Endpoint::METHOD_PUT, Endpoint::METHOD_PATCH] as $method) {
104-
$entity = $entity->fromRequest($bodyRequest->withMethod($method));
102+
$bodyRequest = $request
103+
->withBody(Utils::streamFor(json_encode(['foo' => 1])))
104+
->withMethod($method);
105+
106+
$entity = $entity->fromRequest($bodyRequest);
105107

106108
Assert::same(1, $entity->foo);
107109
}

0 commit comments

Comments
 (0)