Esempio n. 1
0
 /**
  * Verifies that an item with an expiration time in the past won't be retrieved.
  *
  * @param mixed $value
  *   A value to try and cache.
  *
  * @dataProvider providerPrimitiveValues
  */
 public function testExpiresAt($value)
 {
     $pool = new MemoryPool();
     $item = $pool->getItem('foo');
     $item->set($value)->expiresAt(new \DateTime('-1 minute'));
     $pool->save($item);
     $item = $pool->getItem('foo');
     $this->assertNull($item->get());
     $this->assertFalse($item->isHit());
 }
Esempio n. 2
0
 /**
  * Verifies key's name in negative cases.
  *
  * @param string $key
  *   The key's name.
  *
  * @expectedException InvalidArgumentException
  * @dataProvider providerNotValidKeyNames
  */
 public function testNegativeValidateKey($key)
 {
     $this->pool->getItem($key);
 }