GraphQL\Tests\Executor\VariablesTest::testDoesNotAllowUnknownTypesToBeUsedAsValues PHP Method

testDoesNotAllowUnknownTypesToBeUsedAsValues() public method

    public function testDoesNotAllowUnknownTypesToBeUsedAsValues()
    {
        $doc = '
        query q($input: UnknownType!) {
          fieldWithObjectInput(input: $input)
        }
        ';
        $ast = Parser::parse($doc);
        $vars = ['input' => 'whoknows'];
        try {
            Executor::execute($this->schema(), $ast, null, null, $vars);
            $this->fail('Expected exception not thrown');
        } catch (Error $error) {
            $expected = FormattedError::create('Variable "$input" expected value of type "UnknownType!" which ' . 'cannot be used as an input type.', [new SourceLocation(2, 25)]);
            $this->assertEquals($expected, Error::formatError($error));
        }
    }