File tree Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change 17
17
use Behat \Gherkin \Node \PyStringNode ;
18
18
use Behatch \Context \RestContext ;
19
19
use Behatch \HttpCall \Request ;
20
+ use GraphQL \Type \Introspection ;
20
21
21
22
/**
22
23
* Context for GraphQL.
@@ -95,6 +96,15 @@ public function ISendTheGraphqlRequestWithOperation(string $operation)
95
96
$ this ->sendGraphqlRequest ();
96
97
}
97
98
99
+ /**
100
+ * @When I send the query to introspect the schema
101
+ */
102
+ public function ISendTheQueryToIntrospectTheSchema ()
103
+ {
104
+ $ this ->graphqlRequest = ['query ' => Introspection::getIntrospectionQuery ()];
105
+ $ this ->sendGraphqlRequest ();
106
+ }
107
+
98
108
private function sendGraphqlRequest ()
99
109
{
100
110
$ this ->request ->setHttpHeader ('Accept ' , null );
Original file line number Diff line number Diff line change @@ -9,20 +9,13 @@ Feature: GraphQL introspection support
9
9
And the JSON node "errors[0].message" should be equal to "GraphQL query is not valid"
10
10
11
11
Scenario : Introspect the GraphQL schema
12
- When I send the following GraphQL request:
13
- """
14
- {
15
- __schema {
16
- types {
17
- name
18
- }
19
- }
20
- }
21
- """
12
+ When I send the query to introspect the schema
22
13
Then the response status code should be 200
23
14
And the response should be in JSON
24
15
And the header "Content-Type" should be equal to "application/json"
25
16
And the JSON node "data.__schema.types" should exist
17
+ And the JSON node "data.__schema.queryType.name" should be equal to "Query"
18
+ And the JSON node "data.__schema.mutationType.name" should be equal to "Mutation"
26
19
27
20
Scenario : Introspect types
28
21
When I send the following GraphQL request:
You can’t perform that action at this time.
0 commit comments