createCursor() public method

Creates a new instance of a non embedded Cursor.
public createCursor ( Schema $entitySchema, MongoDB\Collection $collection, string $command, array $params, boolean $cacheable = false ) : Cursor
$entitySchema Mongolid\Schema\Schema Schema that describes the entity that will be retrieved from the database.
$collection MongoDB\Collection The raw collection object that will be used to retrieve the documents.
$command string The command that is being called in the $collection.
$params array The parameters of the $command.
$cacheable boolean Retrieves a CacheableCursor instead.
return Cursor
 public function testShouldCreateACacheableCursor()
 {
     // Set
     $factory = new CursorFactory();
     $schema = m::mock(Schema::class);
     $collection = m::mock(Collection::class);
     // Assert
     $result = $factory->createCursor($schema, $collection, 'find', $params = ['age' => ['$gr' => 25]], true);
     $this->assertInstanceOf(Cursor::class, $result);
     $this->assertInstanceOf(CacheableCursor::class, $result);
     $this->assertNotInstanceOf(EmbeddedCursor::class, $result);
     $this->assertAttributeEquals($schema, 'entitySchema', $result);
     $this->assertAttributeEquals($collection, 'collection', $result);
     $this->assertAttributeEquals('find', 'command', $result);
     $this->assertAttributeEquals($params, 'params', $result);
 }