Skip to content

Commit 3e3e072

Browse files
committed
Attempt to fix transient tests
1 parent 297e783 commit 3e3e072

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

tests/GraphQl/Action/EntrypointActionTest.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,23 @@
2828
*/
2929
class EntrypointActionTest extends TestCase
3030
{
31+
/**
32+
* Hack to avoid transient failing test because of Date header.
33+
*/
34+
private function assertEqualsWithoutDateHeader(JsonResponse $expected, JsonResponse $actual)
35+
{
36+
$expected->headers->remove('Date');
37+
$actual->headers->remove('Date');
38+
$this->assertEquals($expected, $actual);
39+
}
40+
3141
public function testGetAction()
3242
{
3343
$request = new Request(['query' => 'graphqlQuery', 'variables' => '["graphqlVariable"]', 'operation' => 'graphqlOperationName']);
3444
$request->setRequestFormat('json');
3545
$mockedEntrypoint = $this->getEntrypointAction($request);
3646

37-
$this->assertEquals(new JsonResponse(['GraphQL']), $mockedEntrypoint($request));
47+
$this->assertEqualsWithoutDateHeader(new JsonResponse(['GraphQL']), $mockedEntrypoint($request));
3848
}
3949

4050
public function testPostRawAction()
@@ -44,7 +54,7 @@ public function testPostRawAction()
4454
$request->headers->set('Content-Type', 'application/graphql');
4555
$mockedEntrypoint = $this->getEntrypointAction($request);
4656

47-
$this->assertEquals(new JsonResponse(['GraphQL']), $mockedEntrypoint($request));
57+
$this->assertEqualsWithoutDateHeader(new JsonResponse(['GraphQL']), $mockedEntrypoint($request));
4858
}
4959

5060
public function testPostJsonAction()
@@ -54,7 +64,7 @@ public function testPostJsonAction()
5464
$request->headers->set('Content-Type', 'application/json');
5565
$mockedEntrypoint = $this->getEntrypointAction($request);
5666

57-
$this->assertEquals(new JsonResponse(['GraphQL']), $mockedEntrypoint($request));
67+
$this->assertEqualsWithoutDateHeader(new JsonResponse(['GraphQL']), $mockedEntrypoint($request));
5868
}
5969

6070
public function testBadContentTypePostAction()

0 commit comments

Comments
 (0)