/** * 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.'); }
/** * 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.'); }