From 0dc04c49bd4aef150fa0b119f144d244c77ec7d9 Mon Sep 17 00:00:00 2001 From: Russell Smith Date: Tue, 11 Oct 2016 15:16:14 +1100 Subject: [PATCH] MDL-56347 caching: Better class variables for notices. --- cache/tests/fixtures/lib.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cache/tests/fixtures/lib.php b/cache/tests/fixtures/lib.php index 82c87c5a925..2d865e46a09 100644 --- a/cache/tests/fixtures/lib.php +++ b/cache/tests/fixtures/lib.php @@ -536,6 +536,11 @@ class cache_phpunit_factory extends cache_factory { parent::disable(); } + /** + * @var bool Whether the warning notice about alternative cache store used has been displayed. + */ + protected $altcachestorenotice = false; + /** * Creates a store instance given its name and configuration. * @@ -548,8 +553,6 @@ class cache_phpunit_factory extends cache_factory { */ public function create_store_from_config($name, array $details, cache_definition $definition) { - static $noticeshown = false; - if (isset($details['use_test_store'])) { // name, plugin, alt $class = 'cachestore_'.$details['plugin']; @@ -563,10 +566,10 @@ class cache_phpunit_factory extends cache_factory { } // Notify user that alternative store is being used, so action can be taken. - if (!$noticeshown) { + if (!$this->altcachestorenotice) { echo PHP_EOL . "++ WARNING: " . 'Failed to use "' . $details['plugin'] . '" cache store, alt "' . $details['alt']['plugin'] . '" cache store is used.' . PHP_EOL . PHP_EOL; - $noticeshown = true; + $this->altcachestorenotice = true; } $details = $details['alt']; $details['class'] = 'cachestore_'.$details['plugin'];