From c1db791e98476c8f371d48d41d228eeb11ceb1a1 Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Thu, 9 Oct 2014 09:12:59 +1300 Subject: [PATCH] MDL-47608 cachestore_mongo: fixed unit test error If you configured your site to run mongo unit tests and had the mongo extension and backend installed but did not have the mongo service running you would get a fatal error when running the unit tests. That problem has been fixed by checking the mongo test instance is ready before returning it. --- cache/stores/mongodb/lib.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cache/stores/mongodb/lib.php b/cache/stores/mongodb/lib.php index 4405da4b4cf..e4d51ec92e6 100644 --- a/cache/stores/mongodb/lib.php +++ b/cache/stores/mongodb/lib.php @@ -556,6 +556,9 @@ class cachestore_mongodb extends cache_store implements cache_is_configurable { } $store = new cachestore_mongodb('Test mongodb', $configuration); + if (!$store->is_ready()) { + return false; + } $store->initialise($definition); return $store; @@ -581,6 +584,9 @@ class cachestore_mongodb extends cache_store implements cache_is_configurable { $configuration['usesafe'] = 1; $store = new cachestore_mongodb('Test mongodb', $configuration); + if (!$store->is_ready()) { + return false; + } $store->initialise($definition); return $store; -- 2.43.0