Ejemplo n.º 1
0
    public function testCheckAndSetItem()
    {
        $this->assertTrue($this->_storage->setItem('key', 'value'));

        $success  = null;
        $casToken = null;
        $this->assertEquals('value', $this->_storage->getItem('key', array(), $success, $casToken));
        $this->assertNotNull($casToken);

        $this->assertTrue($this->_storage->checkAndSetItem($casToken, 'key', 'newValue'));
        $this->assertFalse($this->_storage->checkAndSetItem($casToken, 'key', 'failedValue'));
        $this->assertEquals('newValue', $this->_storage->getItem('key'));
    }