summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hamann <michael@content-space.de>2014-03-14 13:08:32 +0100
committerMichael Hamann <michael@content-space.de>2014-03-14 13:08:32 +0100
commit16ca217de8ce72a9c736f35f1a62718437369d88 (patch)
tree725cf569624394ca1e3f54120e1c6318d0e108cb
parenta8795974051a91137b01ff88dbf5586a647b24ce (diff)
downloadrpg-16ca217de8ce72a9c736f35f1a62718437369d88.tar.gz
rpg-16ca217de8ce72a9c736f35f1a62718437369d88.tar.bz2
Add a basic test case for the cache
This very basic test ensures that the useCache method works as expected for simple scenarios. This test case fails without commit a8795974051a91137b01ff88dbf5586a647b24ce and then also triggers the warning that was introduced in bc2ddb548f71b1a822dd03c3bc7c3c0e7cd9b152
-rw-r--r--_test/tests/inc/cache_use.test.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/_test/tests/inc/cache_use.test.php b/_test/tests/inc/cache_use.test.php
new file mode 100644
index 000000000..f5349df13
--- /dev/null
+++ b/_test/tests/inc/cache_use.test.php
@@ -0,0 +1,36 @@
+<?php
+
+/**
+ * Class cache_use_test
+ *
+ * Tests if caching can actually be used
+ */
+class cache_use_test extends DokuWikiTest {
+ /** @var cache_renderer $cache */
+ private $cache;
+
+ function setUp() {
+ global $ID;
+ parent::setUp();
+
+ $ID = 'cached';
+ $file = wikiFN($ID);
+
+ saveWikiText($ID, 'Content', 'Created');
+ // set the modification time a second in the past in order to ensure that the cache is newer than the page
+ touch($file, time()-1);
+
+ # Create cache. Note that the metadata cache is used as the xhtml cache triggers metadata rendering
+ $this->cache = new cache_renderer($ID, $file, 'metadata');
+ $this->cache->storeCache('Test');
+ }
+
+ function test_use() {
+ $this->assertTrue($this->cache->useCache());
+ }
+
+
+ function test_purge() {
+ $this->assertFalse($this->cache->useCache(array('purge' => true)));
+ }
+} \ No newline at end of file