Esempio n. 1
0
 public function testDecrement()
 {
     $this->assertFalse(jCache::decrement('InexistentKey', 1, $this->profile));
     $this->assertTrue(jCache::set('integerDataKey', 100, 1, $this->profile));
     $this->assertTrue(jCache::decrement('integerDataKey', 1, $this->profile) == 99);
     $this->assertTrue(jCache::set('floatDataKey', 100.5, 1, $this->profile));
     $this->assertTrue(jCache::decrement('floatDataKey', 1, $this->profile) == 99);
     $this->assertTrue(jCache::set('floatDecrementationKey', 100, 1, $this->profile));
     $this->assertTrue(jCache::decrement('floatDecrementationKey', 1.5, $this->profile) == 99);
     $this->assertTrue(jCache::set('stringDecrementationKey', 1, 1, $this->profile));
     $this->assertFalse(jCache::decrement('stringDecrementationKey', 'decrement by string', $this->profile));
     $this->assertTrue(jCache::set('stringDataKey', 'string data', 1, $this->profile));
     $this->assertFalse(jCache::decrement('stringDataKey', 100, $this->profile));
     $this->assertTrue(jCache::set('arrayDataKey', array(1), 1, $this->profile));
     $this->assertFalse(jCache::decrement('arrayDataKey', 1, $this->profile));
     $oData = (object) array('property1' => 'string', 'property2' => 1);
     $this->assertTrue(jCache::set('objectDataKey', $oData, 1, $this->profile));
     $this->assertFalse(jCache::decrement('objectDataKey', 1, $this->profile));
 }