Mongolid\Cursor\CursorTest::getCursor PHP Method

getCursor() protected method

protected getCursor ( $entitySchema = null, $collection = null, $command = 'find', $params = [[]], $driverCursor = null )
    protected function getCursor($entitySchema = null, $collection = null, $command = 'find', $params = [[]], $driverCursor = null)
    {
        if (!$entitySchema) {
            $entitySchema = m::mock(Schema::class . '[]');
        }
        if (!$collection) {
            $collection = m::mock(Collection::class);
        }
        if (!$driverCursor) {
            return new Cursor($entitySchema, $collection, $command, $params);
        }
        $mock = m::mock(Cursor::class . '[getCursor]', [$entitySchema, $collection, $command, $params]);
        $mock->shouldAllowMockingProtectedMethods();
        $mock->shouldReceive('getCursor')->andReturn($driverCursor);
        $this->setProtected($mock, 'cursor', $driverCursor);
        return $mock;
    }