/** * @it fails as expected on the __type root field without an arg */ public function testFailsAsExpectedOnThe__typeRootFieldWithoutAnArg() { $TestType = new ObjectType(['name' => 'TestType', 'fields' => ['testField' => ['type' => Type::string()]]]); $schema = new Schema(['query' => $TestType]); $request = ' { __type { name } } '; $expected = ['errors' => [FormattedError::create(ProvidedNonNullArguments::missingFieldArgMessage('__type', 'name', 'String!'), [new SourceLocation(3, 9)])]]; $this->assertEquals($expected, GraphQL::execute($schema, $request)); }
private function missingFieldArg($fieldName, $argName, $typeName, $line, $column) { return FormattedError::create(ProvidedNonNullArguments::missingFieldArgMessage($fieldName, $argName, $typeName), [new SourceLocation($line, $column)]); }