28
28
*/
29
29
class EntrypointActionTest extends TestCase
30
30
{
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
+
31
41
public function testGetAction ()
32
42
{
33
43
$ request = new Request (['query ' => 'graphqlQuery ' , 'variables ' => '["graphqlVariable"] ' , 'operation ' => 'graphqlOperationName ' ]);
34
44
$ request ->setRequestFormat ('json ' );
35
45
$ mockedEntrypoint = $ this ->getEntrypointAction ($ request );
36
46
37
- $ this ->assertEquals (new JsonResponse (['GraphQL ' ]), $ mockedEntrypoint ($ request ));
47
+ $ this ->assertEqualsWithoutDateHeader (new JsonResponse (['GraphQL ' ]), $ mockedEntrypoint ($ request ));
38
48
}
39
49
40
50
public function testPostRawAction ()
@@ -44,7 +54,7 @@ public function testPostRawAction()
44
54
$ request ->headers ->set ('Content-Type ' , 'application/graphql ' );
45
55
$ mockedEntrypoint = $ this ->getEntrypointAction ($ request );
46
56
47
- $ this ->assertEquals (new JsonResponse (['GraphQL ' ]), $ mockedEntrypoint ($ request ));
57
+ $ this ->assertEqualsWithoutDateHeader (new JsonResponse (['GraphQL ' ]), $ mockedEntrypoint ($ request ));
48
58
}
49
59
50
60
public function testPostJsonAction ()
@@ -54,7 +64,7 @@ public function testPostJsonAction()
54
64
$ request ->headers ->set ('Content-Type ' , 'application/json ' );
55
65
$ mockedEntrypoint = $ this ->getEntrypointAction ($ request );
56
66
57
- $ this ->assertEquals (new JsonResponse (['GraphQL ' ]), $ mockedEntrypoint ($ request ));
67
+ $ this ->assertEqualsWithoutDateHeader (new JsonResponse (['GraphQL ' ]), $ mockedEntrypoint ($ request ));
58
68
}
59
69
60
70
public function testBadContentTypePostAction ()
0 commit comments