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

testDoesNotAllowInvalidTypesToBeUsedAsValues() public method

    public function testDoesNotAllowInvalidTypesToBeUsedAsValues()
    {
        $doc = '
        query q($input: TestType!) {
          fieldWithObjectInput(input: $input)
        }
        ';
        $ast = Parser::parse($doc);
        $vars = ['input' => ['list' => ['A', 'B']]];
        try {
            Executor::execute($this->schema(), $ast, null, null, $vars);
            $this->fail('Expected exception not thrown');
        } catch (Error $error) {
            $expected = ['message' => 'Variable "$input" expected value of type "TestType!" which cannot ' . 'be used as an input type.', 'locations' => [['line' => 2, 'column' => 25]]];
            $this->assertEquals($expected, Error::formatError($error));
        }
    }