예제 #1
0
 public function testIncrement()
 {
     $this->assertFalse(jCache::increment('InexistentKey', 1, $this->profile));
     $this->assertTrue(jCache::set('integerDataKey', 100, 1, $this->profile));
     $this->assertTrue(jCache::increment('integerDataKey', 1, $this->profile) == 101);
     $this->assertTrue(jCache::set('floatDataKey', 100.5, 1, $this->profile));
     $this->assertEqual(jCache::get('floatDataKey', $this->profile), 100.5);
     $this->assertEqual(jCache::increment('floatDataKey', 1, $this->profile), 101);
     $this->assertTrue(jCache::set('floatIncrementationKey', 100, 1, $this->profile));
     $this->assertEqual(jCache::increment('floatIncrementationKey', 1.5, $this->profile), 101);
     $this->assertTrue(jCache::set('stringIncrementationKey', 1, 1, $this->profile));
     $this->assertFalse(jCache::increment('stringIncrementationKey', 'increment by string', $this->profile));
     $this->assertTrue(jCache::set('stringDataKey', 'string data', 1, $this->profile));
     $this->assertFalse(jCache::increment('stringDataKey', 100, $this->profile));
     $this->assertTrue(jCache::set('arrayDataKey', array(1), 1, $this->profile));
     $this->assertFalse(jCache::increment('arrayDataKey', 1, $this->profile));
     $oData = (object) array('property1' => 'string', 'property2' => 1);
     $this->assertTrue(jCache::set('objectDataKey', $oData, 1, $this->profile));
     $this->assertFalse(jCache::increment('objectDataKey', 1, $this->profile));
 }