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

increment() public method

public increment ( UnitTester $I )
$I UnitTester
    public function increment(UnitTester $I)
    {
        $I->wantTo('Increment counter by using Memory as cache backend');
        $key = 'increment';
        $cache = new Memory(new Data(['lifetime' => 20]));
        $I->setProtectedProperty($cache, '_data', [$key => 20]);
        $I->assertEquals(21, $cache->increment($key));
        $I->assertEquals(24, $cache->increment($key, 3));
        $I->assertEquals(54, $cache->increment($key, 30));
        $I->assertEquals([$key => 54], $I->getProtectedProperty($cache, '_data'));
    }