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

increment() public method

public increment ( UnitTester $I )
$I UnitTester
    public function increment(UnitTester $I)
    {
        $I->wantTo('Increment counter by using APC(u) as cache backend');
        $key = '_PHCA' . 'increment';
        $cache = new Apc(new Data(['lifetime' => 20]));
        $I->dontSeeInApc($key);
        $I->haveInApc($key, 1);
        $I->assertEquals(2, $cache->increment('increment'));
        $I->seeInApc($key, 2);
        $I->assertEquals(4, $cache->increment('increment', 2));
        $I->seeInApc($key, 4);
        $I->assertEquals(14, $cache->increment('increment', 10));
        $I->seeInApc($key, 14);
        $key = '_PHCA' . 'increment-2';
        $I->dontSeeInApc($key);
        $I->haveInApc($key, 90);
        $I->assertEquals(91, $cache->increment('increment-2'));
        $I->seeInApc($key, 91);
        $I->assertEquals(97, $cache->increment('increment-2', 6));
        $I->seeInApc($key, 97);
        $I->assertEquals(200, $cache->increment('increment-2', 103));
        $I->seeInApc($key, 200);
    }