public function testShouldGetOriginalCursorFromDatabaseAfterTheDocumentLimit()
{
// Arrange
$documentsFromDb = [['name' => 'joe'], ['name' => 'doe']];
$cursor = $this->getCachableCursor()->limit(150);
$cacheComponent = m::mock(CacheComponentInterface::class);
$rawCollection = m::mock();
$this->setProtected($cursor, 'position', CacheableCursor::DOCUMENT_LIMIT + 1);
$this->setProtected($cursor, 'collection', $rawCollection);
// Act
$cursor->shouldReceive('generateCacheKey')->never();
Ioc::instance(CacheComponentInterface::class, $cacheComponent);
$cacheComponent->shouldReceive('get')->with('find:collection:123', null)->never();
$rawCollection->shouldReceive('find')->with([], ['skip' => CacheableCursor::DOCUMENT_LIMIT, 'limit' => 49])->andReturn(new ArrayIterator($documentsFromDb));
$cacheComponent->shouldReceive('put')->never();
// Assert
$this->assertEquals(new IteratorIterator(new ArrayIterator($documentsFromDb)), $this->callProtected($cursor, 'getCursor'));
}