Inheritance: extends Tokenizer
示例#1
0
 public function testVariablesInQuery()
 {
     $parser = new Parser();
     $data = $parser->parse('
         query StarWarsAppHomeRoute($names_0:[String]!, $query: String) {
           factions(names:$names_0, test: $query) {
             id,
             ...F2
           }
         }
         fragment F0 on Ship {
           id,
           name
         }
         fragment F1 on Faction {
           id,
           factionId
         }
         fragment F2 on Faction {
           id,
           factionId,
           name,
           _shipsDRnzJ:ships(first:10) {
             edges {
               node {
                 id,
                 ...F0
               },
               cursor
             },
             pageInfo {
               hasNextPage,
               hasPreviousPage
             }
           },
           ...F1
         }
     ');
     $this->assertArrayNotHasKey('errors', $data);
 }
示例#2
0
 protected function parseAndCreateRequest($payload, $variables = [])
 {
     if (empty($payload)) {
         throw new \InvalidArgumentException('Must provide an operation.');
     }
     $parser = new Parser();
     $request = new Request($parser->parse($payload), $variables);
     (new RequestValidator())->validate($request);
     $this->executionContext->setRequest($request);
 }