Skip to content
Snippets Groups Projects
Commit c3cf5a6c authored by Martin Doucha's avatar Martin Doucha
Browse files

Stale cache unittest

parent 2302d6be
No related branches found
No related tags found
No related merge requests found
<?php
require_once DOKU_INC . 'inc/parserutils.php';
class cache_stalecheck_test extends DokuWikiTest {
function test_staleness() {
global $ID;
$ID = 'stale';
$file = wikiFN($ID);
# Prepare test page
saveWikiText($ID, 'Fresh', 'Created');
# Create stale cache
$cache = new cache_renderer($ID, $file, 'xhtml');
$cache->storeCache('Stale');
$stale = $cache->retrieveCache();
# Prepare stale cache for testing
$time = filemtime($file);
touch($cache->cache, $time);
# Make the test
$fresh = p_cached_output($file, 'xhtml', $ID);
$this->assertNotEquals($fresh, $stale, 'Stale cache failed to expire');
}
}
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment