Mongolid\Cursor\CursorTest::testShouldSerializeAnActiveCursor PHP Method

testShouldSerializeAnActiveCursor() public method

    public function testShouldSerializeAnActiveCursor()
    {
        // Arrange
        $pool = m::mock(Pool::class);
        $conn = m::mock(Connection::class);
        $schema = new DynamicSchema();
        $cursor = $this->getCursor($schema, null, 'find', [[]]);
        $driverCollection = $this->getDriverCollection();
        $this->setProtected($cursor, 'collection', $driverCollection);
        // Act
        Ioc::instance(Pool::class, $pool);
        $pool->shouldReceive('getConnection')->andReturn($conn);
        $conn->shouldReceive('getRawConnection')->andReturn($conn);
        $conn->defaultDatabase = 'db';
        $conn->db = $conn;
        $conn->my_collection = $driverCollection;
        // Return the same driver Collection
        // Assert
        $result = unserialize(serialize($cursor));
        $this->assertEquals($cursor, $result);
    }