summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorMichael Hamann <michael@content-space.de>2012-07-25 18:26:35 +0200
committerMichael Hamann <michael@content-space.de>2012-07-25 18:26:35 +0200
commit0d24b616cdb7336b978e6ecd0c1f845c1804f85f (patch)
tree99a4a023a8223f2f9b56c5a7ddc02065108dc721 /inc
parentb3d1090ed94469e7a1f38c0352a8a4184a6ac846 (diff)
downloadrpg-0d24b616cdb7336b978e6ecd0c1f845c1804f85f.tar.gz
rpg-0d24b616cdb7336b978e6ecd0c1f845c1804f85f.tar.bz2
Disable some parser and renderer caches during tests FS#2564
This disables some caches which use static variables in order to prevent parsing or rendering of the same page more than once during a run and also disables the cache of parser modes. This means we can no longer test this behavior but at least it fixes syntax plugin tests and tests which change pages in order to test certain caching behaviors.
Diffstat (limited to 'inc')
-rw-r--r--inc/parserutils.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/inc/parserutils.php b/inc/parserutils.php
index 55b451c76..bbe0db1c0 100644
--- a/inc/parserutils.php
+++ b/inc/parserutils.php
@@ -212,7 +212,7 @@ function p_cached_instructions($file,$cacheonly=false,$id='') {
$cache = new cache_instructions($id, $file);
- if ($cacheonly || $cache->useCache() || isset($run[$file])) {
+ if ($cacheonly || $cache->useCache() || (isset($run[$file]) && !defined('DOKU_UNITTEST'))) {
return $cache->retrieveCache();
} else if (@file_exists($file)) {
// no cache - do some work
@@ -311,8 +311,10 @@ function p_get_metadata($id, $key='', $render=METADATA_RENDER_USING_CACHE){
}
}
if ($do_render) {
- ++$render_count;
- $rendered_pages[$id] = true;
+ if (!defined('DOKU_UNITTEST')) {
+ ++$render_count;
+ $rendered_pages[$id] = true;
+ }
$old_meta = $meta;
$meta = p_render_metadata($id, $meta);
// only update the file when the metadata has been changed
@@ -547,7 +549,7 @@ function p_get_parsermodes(){
//reuse old data
static $modes = null;
- if($modes != null){
+ if($modes != null && !defined('DOKU_UNITTEST')){
return $modes;
}