33namespace TheCodingMachine \GraphQLite \Http ;
44
55use Exception ;
6+ use GraphQL \Error \ClientAware ;
67use GraphQL \Error \Error ;
78use GraphQL \Executor \ExecutionResult ;
89use PHPUnit \Framework \TestCase ;
@@ -32,6 +33,19 @@ public function testDecideHttpStatusCode(): void
3233 $ exception600 = new Exception ('foo ' , 600 );
3334 $ errorCode600 = new Error ('Foo ' , null , null , null , null , $ exception600 );
3435
36+ $ clientAwareException = new class extends Exception implements ClientAware {
37+ public function isClientSafe ()
38+ {
39+ return true ;
40+ }
41+
42+ public function getCategory ()
43+ {
44+ return 'foo ' ;
45+ }
46+ };
47+ $ clientAwareError = new Error ('Foo ' , null , null , null , null , $ clientAwareException );
48+
3549 $ executionResult = new ExecutionResult (null , [ $ errorCode0 ]);
3650 $ this ->assertSame (500 , $ codeDecider ->decideHttpStatusCode ($ executionResult ));
3751
@@ -40,5 +54,8 @@ public function testDecideHttpStatusCode(): void
4054
4155 $ executionResult = new ExecutionResult (null , [ $ graphqlError ]);
4256 $ this ->assertSame (400 , $ codeDecider ->decideHttpStatusCode ($ executionResult ));
57+
58+ $ executionResult = new ExecutionResult (null , [ $ clientAwareError ]);
59+ $ this ->assertSame (400 , $ codeDecider ->decideHttpStatusCode ($ executionResult ));
4360 }
4461}
0 commit comments