Skip to content

Commit 3f7f2a9

Browse files
committed
Improving code coverage
1 parent 2786b9a commit 3f7f2a9

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

Controller/GraphqliteController.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,7 @@ private function handlePsr7Request(ServerRequestInterface $request): JsonRespons
117117
private function decideHttpStatusCode(ExecutionResult $result): int
118118
{
119119
// If the data entry in the response has any value other than null (when the operation has successfully executed without error) then the response should use the 200 (OK) status code.
120-
if ($result->data !== null) {
121-
return 200;
122-
}
123-
124-
if (empty($result->errors)) {
120+
if ($result->data !== null || empty($result->errors)) {
125121
return 200;
126122
}
127123

Tests/Fixtures/Controller/TestGraphqlController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function contacts(): ArrayResult
6262
* @Query()
6363
* @return string
6464
*/
65-
public function triggerException(int $code = 500): string
65+
public function triggerException(int $code = 0): string
6666
{
6767
throw new MyException('Boom', $code);
6868
}

0 commit comments

Comments
 (0)