From 502b66f53d88bf59a43b9dcbcbabc14f9b48d802 Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Tue, 11 Oct 2016 10:35:19 +0800 Subject: [PATCH] MDL-56347 phpunit: Set class for alternative cache store If alternative cache store is sued, then set the class and warn user about this. --- cache/tests/fixtures/lib.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cache/tests/fixtures/lib.php b/cache/tests/fixtures/lib.php index 7b05b2e734a..45e3a801bcb 100644 --- a/cache/tests/fixtures/lib.php +++ b/cache/tests/fixtures/lib.php @@ -548,6 +548,8 @@ 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']; @@ -559,7 +561,15 @@ class cache_phpunit_factory extends cache_factory { return $instance; } } + + // Notify user that alternative store is being used, so action can be taken. + if (!$noticeshown) { + 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; + } $details = $details['alt']; + $details['class'] = 'cachestore_'.$details['plugin']; $name = $details['name']; }