コード例 #1
0
 /**
  * Tests the Joomla\Cache\File::isExpired method.
  *
  * @return  void
  *
  * @covers  Joomla\Cache\File::isExpired
  * @since   1.0
  */
 public function testIsExpired()
 {
     $this->instance->setOption('ttl', 1);
     $this->instance->set('foo', 'bar');
     sleep(2);
     $this->assertTrue(TestHelper::invoke($this->instance, 'isExpired', 'foo'), 'Should be expired.');
     $this->instance->setOption('ttl', 900);
     $this->instance->set('foo', 'bar');
     $this->assertFalse(TestHelper::invoke($this->instance, 'isExpired', 'foo'), 'Should not be expired.');
 }
コード例 #2
0
ファイル: FileTest.php プロジェクト: viesagroup/Prisma
 /**
  * Tests the Joomla\Cache\File::isExpired method.
  *
  * @return  void
  *
  * @covers  Joomla\Cache\File::isExpired
  * @since   1.0
  */
 public function testIsExpired()
 {
     $this->instance->setOption('ttl', 1);
     $this->instance->set('foo', 'bar');
     $fileName = TestHelper::invoke($this->instance, 'fetchStreamUri', 'foo');
     touch($fileName, time() - 2);
     $this->assertTrue(TestHelper::invoke($this->instance, 'isExpired', 'foo'), 'Should be expired.');
     $this->instance->setOption('ttl', 900);
     $this->instance->set('foo', 'bar');
     $this->assertFalse(TestHelper::invoke($this->instance, 'isExpired', 'foo'), 'Should not be expired.');
 }