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

testReportsErrorForNonProvidedVariablesForNonNullableInputs() public method

    public function testReportsErrorForNonProvidedVariablesForNonNullableInputs()
    {
        // Note: this test would typically fail validation before encountering
        // this execution error, however for queries which previously validated
        // and are being run against a new schema which have introduced a breaking
        // change to make a formerly non-required argument required, this asserts
        // failure before allowing the underlying code to receive a non-null value.
        $doc = '
      {
        fieldWithNonNullableStringInput(input: $foo)
      }
        ';
        $ast = Parser::parse($doc);
        $expected = ['data' => ['fieldWithNonNullableStringInput' => null], 'errors' => [['message' => 'Argument "input" of required type "String!" was provided the ' . 'variable "$foo" which was not provided a runtime value.', 'locations' => [['line' => 3, 'column' => 48]], 'path' => ['fieldWithNonNullableStringInput']]]];
        $this->assertEquals($expected, Executor::execute($this->schema(), $ast)->toArray());
    }