MDL-40700 tests: skip if there is not instance
Various reasons can lead to the cache stores not being available (missing extension, configuration...). Under those situations the test must be skipped because for sure it will break if we continue.
This commit is contained in:
+5
-1
@@ -67,6 +67,10 @@ class cachestore_memcache_test extends cachestore_tests {
|
||||
$definition = cache_definition::load_adhoc(cache_store::MODE_APPLICATION, 'cachestore_memcache', 'phpunit_test');
|
||||
$instance = cachestore_memcache::initialise_test_instance($definition);
|
||||
|
||||
if (!$instance) { // Something prevented memcache store to be inited (extension, TEST_CACHESTORE_MEMCACHE_TESTSERVERS...).
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
|
||||
$keys = array(
|
||||
// Alphanumeric.
|
||||
'abc', 'ABC', '123', 'aB1', '1aB',
|
||||
@@ -86,4 +90,4 @@ class cachestore_memcache_test extends cachestore_tests {
|
||||
$this->assertEquals($key, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -67,6 +67,10 @@ 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) { // Something prevented memcached store to be inited (extension, TEST_CACHESTORE_MEMCACHED_TESTSERVERS...).
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
|
||||
$keys = array(
|
||||
// Alphanumeric.
|
||||
'abc', 'ABC', '123', 'aB1', '1aB',
|
||||
@@ -86,4 +90,4 @@ class cachestore_memcached_test extends cachestore_tests {
|
||||
$this->assertEquals($key, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user