Skip to content

Commit

Permalink
Merge branch '5.3' into 5.4
Browse files Browse the repository at this point in the history
* 5.3:
  [HttpKernel] Relax some transient tests
  • Loading branch information
xabbuh committed Oct 1, 2021
2 parents f5c8430 + 199c714 commit fb82a47
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
use Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface;

/**
* @group time-sensitive
*/
class FragmentHandlerTest extends TestCase
{
private $requestStack;
Expand Down Expand Up @@ -71,7 +68,20 @@ public function testDeliverWithUnsuccessfulResponse()

public function testRender()
{
$handler = $this->getHandler($this->returnValue(new Response('foo')), ['/', Request::create('/'), ['foo' => 'foo', 'ignore_errors' => true]]);
$expectedRequest = Request::create('/');
$handler = $this->getHandler(
$this->returnValue(new Response('foo')),
[
'/',
$this->callback(function (Request $request) use ($expectedRequest) {
$expectedRequest->server->remove('REQUEST_TIME_FLOAT');
$request->server->remove('REQUEST_TIME_FLOAT');

return $expectedRequest == $request;
}),
['foo' => 'foo', 'ignore_errors' => true],
]
);

$this->assertEquals('foo', $handler->render('/', 'foo', ['foo' => 'foo']));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,18 @@ public function testIpAddressOfRangedTrustedProxyIsSetAsRemote()
/**
* Creates a Kernel expecting a request equals to $request.
*/
private function getKernelExpectingRequest(Request $request, $strict = false)
private function getKernelExpectingRequest(Request $expectedRequest)
{
$kernel = $this->createMock(HttpKernelInterface::class);
$kernel
->expects($this->once())
->method('handle')
->with($request)
->with($this->callback(function (Request $request) use ($expectedRequest) {
$expectedRequest->server->remove('REQUEST_TIME_FLOAT');
$request->server->remove('REQUEST_TIME_FLOAT');

return $expectedRequest == $request;
}))
->willReturn(new Response('foo'));

return $kernel;
Expand Down

0 comments on commit fb82a47

Please sign in to comment.