diff options
Diffstat (limited to '_test')
-rw-r--r-- | _test/core/DokuWikiTest.php | 3 | ||||
-rw-r--r-- | _test/tests/inc/cache_use.test.php | 36 |
2 files changed, 39 insertions, 0 deletions
diff --git a/_test/core/DokuWikiTest.php b/_test/core/DokuWikiTest.php index 91eb5293b..f4521256a 100644 --- a/_test/core/DokuWikiTest.php +++ b/_test/core/DokuWikiTest.php @@ -115,5 +115,8 @@ abstract class DokuWikiTest extends PHPUnit_Framework_TestCase { // reload language $local = $conf['lang']; trigger_event('INIT_LANG_LOAD', $local, 'init_lang', true); + + global $INPUT; + $INPUT = new Input(); } } 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 |