/** * Unit test for eZURLWildcard::isCacheExpired() * * depends testTranslateDirect */ public function testIsCacheExpired() { $time = time(); $this->assertFalse(eZURLWildcard::isCacheExpired($time + 1), "Cache should not be expired"); eZURLWildcard::expireCache(); $this->assertTrue(eZURLWildcard::isCacheExpired($time - 1), "Cache should be expired"); }
/** * Unit test for eZURLWildcard::isCacheExpired() **/ public function testIsCacheExpired() { $time = time(); // Cleanup cache & existing wildcards self::removeAllWildcards(); self::createWildcard("testDoubleTranslation1/*", 'content/view/full/2', eZURLWildcard::TYPE_DIRECT); $ret = eZURLWildcard::translate($uri = "testDoubleTranslation1/abc"); sleep(1); $this->assertFalse(eZURLWildcard::isCacheExpired($time), "Cache should not be expired"); eZURLWIldcard::expireCache(); sleep(1); $this->assertTrue(eZURLWildcard::isCacheExpired($time + 1), "Cache should be expired"); }