diff --git a/_test/tests/inc/cache_stalecheck.test.php b/_test/tests/inc/cache_stalecheck.test.php new file mode 100644 index 0000000000000000000000000000000000000000..6f17fcea7e0d8e2de07e8ffb7dd8ea4cabb849eb --- /dev/null +++ b/_test/tests/inc/cache_stalecheck.test.php @@ -0,0 +1,29 @@ +<?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'); + } +} +?>