GraphQL\Tests\Executor\ListsTest::testHandlesNonNullListOfNonNullsWithPromiseArray PHP Method

testHandlesNonNullListOfNonNullsWithPromiseArray() public method

    public function testHandlesNonNullListOfNonNullsWithPromiseArray()
    {
        // Contains values
        $this->checkHandlesNonNullListOfNonNulls(\React\Promise\resolve([1, 2]), ['data' => ['nest' => ['test' => [1, 2]]]]);
        // Contains null
        $this->checkHandlesNonNullListOfNonNulls(\React\Promise\resolve([1, null, 2]), ['data' => ['nest' => null], 'errors' => [FormattedError::create('Cannot return null for non-nullable field DataType.test.', [new SourceLocation(1, 10)])]]);
        // Returns null
        $this->checkHandlesNonNullListOfNonNulls(\React\Promise\resolve(null), ['data' => ['nest' => null], 'errors' => [FormattedError::create('Cannot return null for non-nullable field DataType.test.', [new SourceLocation(1, 10)])]]);
        // Rejected
        $this->checkHandlesNonNullListOfNonNulls(function () {
            return \React\Promise\reject(new \Exception('bad'));
        }, ['data' => ['nest' => null], 'errors' => [['message' => 'bad', 'locations' => [['line' => 1, 'column' => 10]], 'path' => ['nest', 'test']]]]);
    }