summaryrefslogtreecommitdiff
path: root/_test
diff options
context:
space:
mode:
authorMartin Doucha <next_ghost@quick.cz>2012-07-07 17:40:53 +0200
committerMartin Doucha <next_ghost@quick.cz>2012-07-07 17:40:53 +0200
commitc3cf5a6c01200847740831a4d84070db01f8e820 (patch)
tree39a8e3956696f82b08243005c0996bf305813987 /_test
parent2302d6be19de4e244b16d43628844c7d9df51ffc (diff)
downloadrpg-c3cf5a6c01200847740831a4d84070db01f8e820.tar.gz
rpg-c3cf5a6c01200847740831a4d84070db01f8e820.tar.bz2
Stale cache unittest
Diffstat (limited to '_test')
-rw-r--r--_test/tests/inc/cache_stalecheck.test.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/_test/tests/inc/cache_stalecheck.test.php b/_test/tests/inc/cache_stalecheck.test.php
new file mode 100644
index 000000000..6f17fcea7
--- /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');
+ }
+}
+?>