Neos\Flow\Tests\Unit\Persistence\Generic\QueryResultTest::getFirstReturnsNullIfResultSetIsEmptyAndQueryIsNotInitialized PHP Method

getFirstReturnsNullIfResultSetIsEmptyAndQueryIsNotInitialized() public method

    public function getFirstReturnsNullIfResultSetIsEmptyAndQueryIsNotInitialized()
    {
        $initializedQueryResult = [];
        $queryResult = $this->getAccessibleMock(QueryResult::class, ['dummy'], [$this->query]);
        $this->query->expects($this->once())->method('setLimit')->with(1);
        $queryResult->injectPersistenceManager($this->persistenceManager);
        $mockDataMapper = $this->createMock(DataMapper::class);
        $mockDataMapper->expects($this->once())->method('mapToObjects')->with(['one', 'two'])->will($this->returnValue($initializedQueryResult));
        $queryResult->injectDataMapper($mockDataMapper);
        $this->assertNull($queryResult->getFirst());
    }