/**
  * Test case teardown
  * Restores the INI settings changed in setUp
  */
 public function tearDown()
 {
     eZDB::instance()->query('DELETE FROM ezurlwildcard');
     eZURLWildcard::expireCache();
     clearstatcache();
     sleep(1);
     parent::tearDown();
 }
 /**
  * Test case teardown
  */
 public function tearDown()
 {
     eZURLWildcard::removeByIDs(array($this->wildcard->attribute('id')));
     eZURLWildcard::expireCache();
     clearstatcache();
     sleep(1);
     parent::tearDown();
 }
            if (strlen($wildcardSrcText) == 0) {
                $infoCode = "error-no-wildcard-text";
            } else {
                if (strlen($wildcardDstText) == 0) {
                    $infoCode = "error-no-wildcard-destination-text";
                } else {
                    $wildcard = eZURLWildcard::fetchBySourceURL($wildcardSrcText, false);
                    if ($wildcard) {
                        $infoCode = "feedback-wildcard-exists";
                        $infoData['wildcard_src_url'] = $wildcardSrcText;
                        $infoData['wildcard_dst_url'] = $wildcard['destination_url'];
                    } else {
                        $row = array('source_url' => $wildcardSrcText, 'destination_url' => $wildcardDstText, 'type' => $wildcardType ? eZURLWildcard::TYPE_FORWARD : eZURLWildcard::TYPE_DIRECT);
                        $wildcard = new eZURLWildcard($row);
                        $wildcard->store();
                        eZURLWildcard::expireCache();
                        $infoData['wildcard_src_url'] = $wildcardSrcText;
                        $infoData['wildcard_dst_url'] = $wildcardDstText;
                        $wildcardSrcText = false;
                        $wildcardDstText = false;
                        $wildcardType = false;
                        $infoCode = "feedback-wildcard-created";
                    }
                }
            }
        }
    }
}
// User preferences
$limitList = array(array('id' => 1, 'value' => 10), array('id' => 2, 'value' => 25), array('id' => 3, 'value' => 50), array('id' => 4, 'value' => 100));
$limitID = eZPreferences::value('admin_urlwildcard_list_limit');
 /**
  * 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");
 }
 /**
  * Helper function that removes all the wildcards from the database
  **/
 public static function removeAllWildcards()
 {
     eZDB::instance()->query('DELETE FROM ezurlwildcard');
     eZURLWildcard::expireCache();
     clearstatcache();
     sleep(1);
 }