Beispiel #1
0
 public function testAdd()
 {
     $ttl = strtotime("+1 day");
     try {
         jCache::add('added1Key', 111, $ttl, 'invalidProfil');
         $this->fail("jCache should throw an exeception when we give an invalid profile");
     } catch (jException $e) {
         $this->pass();
     }
     jCache::set('existentKey', array((object) array('x' => 0, 'y' => 0), 'a screen point'), $ttl, $this->profile);
     $this->assertFalse(jCache::add('existentKey', 'add an existing data', $ttl, $this->profile));
     $this->assertTrue(jCache::add('added1Key', 111, $ttl, $this->profile));
     $this->assertTrue(jCache::add('added2Key', 'some text for example', '2020-12-31 00:00:00', $this->profile));
     $this->assertTrue(jCache::add('added3Key', 'for testing ttl', 1, $this->profile));
     $data = jCache::get(array('added1Key', 'added2Key', 'added3Key'), $this->profile);
     $this->assertTrue(isset($data['added1Key']) && isset($data['added2Key']) && isset($data['added3Key']));
 }