public function testShouldGetCursorFromCache()
{
// Arrange
$documentsFromCache = [['name' => 'joe'], ['name' => 'doe']];
$cursor = $this->getCachableCursor();
$cacheComponent = m::mock(CacheComponentInterface::class);
// Act
$cursor->shouldReceive('generateCacheKey')->andReturn('find:collection:123');
Ioc::instance(CacheComponentInterface::class, $cacheComponent);
$cacheComponent->shouldReceive('get')->once()->with('find:collection:123', null)->andReturn($documentsFromCache);
// Assert
$this->assertEquals(new ArrayIterator($documentsFromCache), $this->callProtected($cursor, 'getCursor'));
}