Skip to content
Snippets Groups Projects
Commit 16ca217d authored by Michael Hamann's avatar Michael Hamann
Browse files

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
a8795974 and then also triggers the
warning that was introduced in bc2ddb54
parent a8795974
No related branches found
No related tags found
No related merge requests found
<?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
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