Phalcon\Test\Unit\Cache\Backend\RedisCest::increment PHP Method

increment() public method

public increment ( UnitTester $I )
$I UnitTester
    public function increment(UnitTester $I)
    {
        $I->wantTo('Increment counter by using Redis as cache backend');
        $key = '_PHCR' . 'increment';
        $cache = new Redis(new Data(['lifetime' => 20]), ['host' => TEST_RS_HOST, 'port' => TEST_RS_PORT]);
        $I->dontSeeInRedis($key);
        $I->haveInRedis('string', $key, 1);
        $I->assertEquals(2, $cache->increment('increment'));
        $I->seeInRedis($key, 2);
        $I->assertEquals(4, $cache->increment('increment', 2));
        $I->seeInRedis($key, 4);
        $I->assertEquals(14, $cache->increment('increment', 10));
        $I->seeInRedis($key, 14);
    }