GraphQL\Tests\Executor\NonNullTest::testNullsAnObjectReturnedInAPromiseThatContainsANonNullableFieldThatReturnsNullInaAPromise PHP Метод

testNullsAnObjectReturnedInAPromiseThatContainsANonNullableFieldThatReturnsNullInaAPromise() публичный Метод

    public function testNullsAnObjectReturnedInAPromiseThatContainsANonNullableFieldThatReturnsNullInaAPromise()
    {
        $doc = '
      query Q {
        promiseNest {
          nonNullPromise,
        }
      }
    ';
        $ast = Parser::parse($doc);
        $expected = ['data' => ['promiseNest' => null], 'errors' => [FormattedError::create('Cannot return null for non-nullable field DataType.nonNullPromise.', [new SourceLocation(4, 11)])]];
        Executor::setPromiseAdapter(new ReactPromiseAdapter());
        $this->assertArraySubsetPromise($expected, Executor::execute($this->schema, $ast, $this->nullingData, null, [], 'Q'));
    }