From a330e83ade87c15deaad96a2216c4fde6d7bc2bb Mon Sep 17 00:00:00 2001 From: Russell Smith Date: Mon, 31 Oct 2016 19:44:05 +1100 Subject: [PATCH] MDL-56273 cache: Use is_ready() to determine if cache is really ready. --- cache/stores/memcache/tests/memcache_test.php | 3 ++- cache/stores/memcached/tests/memcached_test.php | 2 +- cache/tests/fixtures/stores.php | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cache/stores/memcache/tests/memcache_test.php b/cache/stores/memcache/tests/memcache_test.php index f88f5fb3ce3..18f486a77ba 100644 --- a/cache/stores/memcache/tests/memcache_test.php +++ b/cache/stores/memcache/tests/memcache_test.php @@ -60,7 +60,8 @@ class cachestore_memcache_test extends cachestore_tests { $instance = new cachestore_memcache('Memcache Test', cachestore_memcache::unit_test_configuration()); $instance->initialise($definition); - if (!$instance) { // Something prevented memcache store to be inited (extension, TEST_CACHESTORE_MEMCACHE_TESTSERVERS...). + if (!$instance->is_ready()) { + // Something prevented memcache store to be inited (extension, TEST_CACHESTORE_MEMCACHE_TESTSERVERS...). $this->markTestSkipped(); } diff --git a/cache/stores/memcached/tests/memcached_test.php b/cache/stores/memcached/tests/memcached_test.php index 08ce677314c..87517c02b9c 100644 --- a/cache/stores/memcached/tests/memcached_test.php +++ b/cache/stores/memcached/tests/memcached_test.php @@ -170,7 +170,7 @@ class cachestore_memcached_test extends cachestore_tests { $definition = cache_definition::load_adhoc(cache_store::MODE_APPLICATION, 'cachestore_memcached', 'phpunit_test'); $instance = cachestore_memcached::initialise_test_instance($definition); - if (!$instance) { + if (!$instance->is_ready()) { $this->markTestSkipped(); } diff --git a/cache/tests/fixtures/stores.php b/cache/tests/fixtures/stores.php index 56f94e74595..7048a7d120e 100644 --- a/cache/tests/fixtures/stores.php +++ b/cache/tests/fixtures/stores.php @@ -65,7 +65,7 @@ abstract class cachestore_tests extends advanced_testcase { $instance = new $class($class.'_test', $class::unit_test_configuration()); $instance->initialise($definition); - if (!$instance) { + if (!$instance->is_ready()) { $this->markTestSkipped('Could not test '.$class.'. No test instance configured for application caches.'); } else { $this->run_tests($instance); @@ -76,7 +76,7 @@ abstract class cachestore_tests extends advanced_testcase { $instance = new $class($class.'_test', $class::unit_test_configuration()); $instance->initialise($definition); - if (!$instance) { + if (!$instance->is_ready()) { $this->markTestSkipped('Could not test '.$class.'. No test instance configured for session caches.'); } else { $this->run_tests($instance); @@ -87,7 +87,7 @@ abstract class cachestore_tests extends advanced_testcase { $instance = new $class($class.'_test', $class::unit_test_configuration()); $instance->initialise($definition); - if (!$instance) { + if (!$instance->is_ready()) { $this->markTestSkipped('Could not test '.$class.'. No test instance configured for request caches.'); } else { $this->run_tests($instance);