public function testCursorAppliesOptions($checkOptionCallback, \Closure $applyOptionCallback = null)
{
$this->skipTestIf(extension_loaded('mongo'));
$query = ['foo' => 'bar'];
$projection = ['_id' => false, 'foo' => true];
$collectionMock = $this->getCollectionMock();
$collectionMock->expects($this->once())->method('find')->with($this->equalTo(TypeConverter::fromLegacy($query)), $this->callback($checkOptionCallback))->will($this->returnValue(new \ArrayIterator([])));
$collection = $this->getCollection('test');
$cursor = $collection->find($query, $projection);
// Replace the original MongoDB collection with our mock
$reflectionProperty = new \ReflectionProperty($cursor, 'collection');
$reflectionProperty->setAccessible(true);
$reflectionProperty->setValue($cursor, $collectionMock);
if ($applyOptionCallback !== null) {
$applyOptionCallback($cursor);
}
// Force query by converting to array
iterator_to_array($cursor);
}