Mongolid\Cursor\CacheableCursorTest::testShouldGenerateUniqueCacheKey PHP Method

testShouldGenerateUniqueCacheKey() public method

    public function testShouldGenerateUniqueCacheKey()
    {
        // Arrange
        $cursor = $this->getCachableCursor(null, null, 'find', [['color' => 'red']]);
        // Act
        $cursor->shouldReceive('generateCacheKey')->passthru();
        $expectedCacheKey = sprintf('%s:%s:%s', 'find', 'my_db.my_collection', md5(serialize([['color' => 'red']])));
        // Assert
        $this->assertEquals($expectedCacheKey, $cursor->generateCacheKey());
    }