protected function getCachableCursor($entitySchema = null, $collection = null, $command = 'find', $params = [[]], $driverCursor = null)
{
if (!$entitySchema) {
$entitySchema = m::mock(Schema::class . '[]');
}
if (!$collection) {
$collection = m::mock(Collection::class);
$collection->shouldReceive('getNamespace')->andReturn('my_db.my_collection');
$collection->shouldReceive('getCollectionName')->andReturn('my_collection');
}
$mock = m::mock(CacheableCursor::class . '[generateCacheKey]', [$entitySchema, $collection, $command, $params]);
$mock->shouldAllowMockingProtectedMethods();
if ($driverCursor) {
$mock->shouldReceive('getCursor')->andReturn($driverCursor);
}
return $mock;
}