We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ 40-62 (lines=23) @@ | ||
37 | ], |
|
38 | ]; |
|
39 | ||
40 | public function testEndpointAction() |
|
41 | { |
|
42 | $client = static::createClient(['test_case' => 'connection']); |
|
43 | ||
44 | $query = <<<EOF |
|
45 | query FriendsQuery { |
|
46 | user { |
|
47 | friends(first: 2) { |
|
48 | totalCount |
|
49 | edges { |
|
50 | friendshipTime |
|
51 | node { |
|
52 | name |
|
53 | } |
|
54 | } |
|
55 | } |
|
56 | } |
|
57 | } |
|
58 | EOF; |
|
59 | $client->request('GET', '/', ['query' => $query], [], ['CONTENT_TYPE' => 'application/graphql']); |
|
60 | $result = $client->getResponse()->getContent(); |
|
61 | $this->assertEquals(['data' => $this->expectedData], json_decode($result, true), $result); |
|
62 | } |
|
63 | ||
64 | /** |
|
65 | * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException |
|
@@ 86-109 (lines=24) @@ | ||
83 | $client->getResponse()->getContent(); |
|
84 | } |
|
85 | ||
86 | public function testEndpointActionWithVariables() |
|
87 | { |
|
88 | $client = static::createClient(['test_case' => 'connection']); |
|
89 | ||
90 | $query = <<<EOF |
|
91 | query FriendsQuery(\$firstFriends: Int) { |
|
92 | user { |
|
93 | friends(first: \$firstFriends) { |
|
94 | totalCount |
|
95 | edges { |
|
96 | friendshipTime |
|
97 | node { |
|
98 | name |
|
99 | } |
|
100 | } |
|
101 | } |
|
102 | } |
|
103 | } |
|
104 | EOF; |
|
105 | ||
106 | $client->request('GET', '/', [], [], ['CONTENT_TYPE' => 'application/json'], json_encode(['query' => $query, 'variables' => '{"firstFriends": 2}'])); |
|
107 | $result = $client->getResponse()->getContent(); |
|
108 | $this->assertEquals(['data' => $this->expectedData], json_decode($result, true), $result); |
|
109 | } |
|
110 | ||
111 | /** |
|
112 | * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException |
|
@@ 115-128 (lines=14) @@ | ||
112 | * @expectedException \Symfony\Component\HttpKernel\Exception\BadRequestHttpException |
|
113 | * @expectedExceptionMessage Variables are invalid JSON |
|
114 | */ |
|
115 | public function testEndpointActionWithInvalidVariables() |
|
116 | { |
|
117 | $client = static::createClient(['test_case' => 'connection']); |
|
118 | ||
119 | $query = <<<EOF |
|
120 | query { |
|
121 | user |
|
122 | } |
|
123 | EOF; |
|
124 | ||
125 | $client->request('GET', '/', ['query' => $query, 'variables' => '"firstFriends": 2}']); |
|
126 | $result = $client->getResponse()->getContent(); |
|
127 | $this->assertEquals(['data' => $this->expectedData], json_decode($result, true), $result); |
|
128 | } |
|
129 | ||
130 | public function testEndpointActionWithOperationName() |
|
131 | { |
|
@@ 130-161 (lines=32) @@ | ||
127 | $this->assertEquals(['data' => $this->expectedData], json_decode($result, true), $result); |
|
128 | } |
|
129 | ||
130 | public function testEndpointActionWithOperationName() |
|
131 | { |
|
132 | $client = static::createClient(['test_case' => 'connection']); |
|
133 | ||
134 | $query = <<<EOF |
|
135 | query FriendsQuery { |
|
136 | user { |
|
137 | friends(first: 2) { |
|
138 | totalCount |
|
139 | edges { |
|
140 | friendshipTime |
|
141 | node { |
|
142 | name |
|
143 | } |
|
144 | } |
|
145 | } |
|
146 | } |
|
147 | } |
|
148 | ||
149 | query FriendsQuery2 { |
|
150 | user { |
|
151 | friends { |
|
152 | totalCount |
|
153 | } |
|
154 | } |
|
155 | } |
|
156 | EOF; |
|
157 | ||
158 | $client->request('POST', '/', ['query' => $query, 'operationName' => 'FriendsQuery'], [], ['CONTENT_TYPE' => 'application/x-www-form-urlencoded']); |
|
159 | $result = $client->getResponse()->getContent(); |
|
160 | $this->assertEquals(['data' => $this->expectedData], json_decode($result, true), $result); |
|
161 | } |
|
162 | } |
|
163 |