diff --git a/cache/README.md b/cache/README.md index 083f4e66e68..71f44f5d8a0 100644 --- a/cache/README.md +++ b/cache/README.md @@ -236,36 +236,36 @@ The second method is a lot more intensive for the system. There are defined inva When you invalidate by event the cache API finds all of the definitions that subscribe to the event, it then loads the stores for each of those definitions and purges the keys from each store. This is obviously a recursive, and therefore, intense process. -### Unit tests -Both the cache API and the cache stores have unit tests. -Please be aware that several of the cache stores require configuration in order to be able operate in the unit tests. -Tests for stores requiring configuration that havn't been configured will be skipped. +### Testing +Both the cache API and the cache stores have tests. +Please be aware that several of the cache stores require configuration in order to be able operate in the tests. +Tests for stores requiring configuration that haven't been configured will be skipped. All configuration is done in your sites config.php through definitions. -The following snippet illustates how to configure the three core cache stores that require configuration. +The following snippet illustrates how to configure the three core cache stores that require configuration. define('TEST_CACHESTORE_MEMCACHE_TESTSERVERS', '127.0.0.1:11211'); define('TEST_CACHESTORE_MEMCACHED_TESTSERVERS', '127.0.0.1:11211'); define('TEST_CACHESTORE_MONGODB_TESTSERVER', 'mongodb://localhost:27017'); -As of Moodle 2.8 it is also possible to set the default cache stores used when running unit tests. +As of Moodle 2.8 it is also possible to set the default cache stores used when running tests. You can do this by adding the following define to your config.php file: - // xxx is one of Memcache, Memecached, mongodb or other cachestore with a test define. + // xxx is one of Memcache, Memcached, mongodb or other cachestore with a test define. define('TEST_CACHE_USING_APPLICATION_STORE', 'xxx'); This allows you to run tests against a defined test store. It uses the defined value to identify a store to test against with a matching TEST_CACHESTORE define. -Alternatively you can also run unit tests against an actual cache config. +Alternatively you can also run tests against an actual cache config. To do this you must add the following to your config.php file: define('TEST_CACHE_USING_ALT_CACHE_CONFIG_PATH', true'); $CFG->altcacheconfigpath = '/a/temp/directory/yoursite.php' -This tells Moodle to use the config at $CFG->altcacheconfigpath when running unit tests. +This tells Moodle to use the config at $CFG->altcacheconfigpath when running tests. There are a couple of considerations to using this method: -* By setting $CFG->altcacheconfigpath your site will store the cache config in the specified path, not just the unit test cache config but your site config as well. +* By setting $CFG->altcacheconfigpath your site will store the cache config in the specified path, not just the test cache config but your site config as well. * If you have configured your cache before setting $CFG->altcacheconfigpath you will need to copy it from moodledata/muc/config.php to the destination you specified. * This allows you to share a cache config between sites. -* It also allows you to use unit tests to test your sites cache config. +* It also allows you to use tests to test your sites cache config. Please be aware that if you are using Memcache or Memcached it is recommended to use dedicated Memcached servers. When caches get purged the memcached servers you have configured get purged, any data stored within them whether it belongs to Moodle or not will be removed. diff --git a/cache/classes/factory.php b/cache/classes/factory.php index b34f6dfae41..fd782224971 100644 --- a/cache/classes/factory.php +++ b/cache/classes/factory.php @@ -126,8 +126,8 @@ class cache_factory { // situation. It will use disabled alternatives where available. require_once($CFG->dirroot.'/cache/disabledlib.php'); self::$instance = new cache_factory_disabled(); - } else if (defined('PHPUNIT_TEST') && PHPUNIT_TEST) { - // We're using the regular factory. + } else if ((defined('PHPUNIT_TEST') && PHPUNIT_TEST) || behat_is_test_site()) { + // We're using the test factory. require_once($CFG->dirroot.'/cache/tests/fixtures/lib.php'); self::$instance = new cache_phpunit_factory(); if (defined('CACHE_DISABLE_STORES') && CACHE_DISABLE_STORES !== false) { @@ -335,16 +335,17 @@ class cache_factory { // The class to use. $class = 'cache_config'; - $unittest = defined('PHPUNIT_TEST') && PHPUNIT_TEST; + // Are we running tests of some form? + $testing = (defined('PHPUNIT_TEST') && PHPUNIT_TEST) || behat_is_test_site(); // Check if this is a PHPUnit test and redirect to the phpunit config classes if it is. - if ($unittest) { + if ($testing) { require_once($CFG->dirroot.'/cache/locallib.php'); require_once($CFG->dirroot.'/cache/tests/fixtures/lib.php'); // We have just a single class for PHP unit tests. We don't care enough about its // performance to do otherwise and having a single method allows us to inject things into it // while testing. - $class = 'cache_config_phpunittest'; + $class = 'cache_config_testing'; } // Check if we need to create a config file with defaults. @@ -352,7 +353,7 @@ class cache_factory { if ($writer || $needtocreate) { require_once($CFG->dirroot.'/cache/locallib.php'); - if (!$unittest) { + if (!$testing) { $class .= '_writer'; } } diff --git a/cache/stores/session/tests/session_test.php b/cache/stores/session/tests/session_test.php index ebf70599e17..8e7528ae448 100644 --- a/cache/stores/session/tests/session_test.php +++ b/cache/stores/session/tests/session_test.php @@ -49,7 +49,7 @@ class cachestore_session_test extends cachestore_tests { * Test the maxsize option. */ public function test_maxsize() { - $config = cache_config_phpunittest::instance(); + $config = cache_config_testing::instance(); $config->phpunit_add_definition('phpunit/one', array( 'mode' => cache_store::MODE_SESSION, 'component' => 'phpunit', @@ -171,7 +171,7 @@ class cachestore_session_test extends cachestore_tests { } public function test_ttl() { - $config = cache_config_phpunittest::instance(); + $config = cache_config_testing::instance(); $config->phpunit_add_definition('phpunit/three', array( 'mode' => cache_store::MODE_SESSION, 'component' => 'phpunit', diff --git a/cache/stores/static/tests/static_test.php b/cache/stores/static/tests/static_test.php index c9795d176b8..0597e9bd6ec 100644 --- a/cache/stores/static/tests/static_test.php +++ b/cache/stores/static/tests/static_test.php @@ -50,7 +50,7 @@ class cachestore_static_test extends cachestore_tests { */ public function test_maxsize() { $defid = 'phpunit/testmaxsize'; - $config = cache_config_phpunittest::instance(); + $config = cache_config_testing::instance(); $config->phpunit_add_definition($defid, array( 'mode' => cache_store::MODE_REQUEST, 'component' => 'phpunit', diff --git a/cache/tests/administration_helper_test.php b/cache/tests/administration_helper_test.php index 68f8d9576b7..95c70de7515 100644 --- a/cache/tests/administration_helper_test.php +++ b/cache/tests/administration_helper_test.php @@ -48,7 +48,7 @@ class core_cache_administration_helper_testcase extends advanced_testcase { public function setUp() { parent::setUp(); cache_factory::reset(); - cache_config_phpunittest::create_default_configuration(); + cache_config_testing::create_default_configuration(); } /** @@ -193,7 +193,7 @@ class core_cache_administration_helper_testcase extends advanced_testcase { set_debugging(DEBUG_ALL); // First with simplekeys - $instance = cache_config_phpunittest::instance(true); + $instance = cache_config_testing::instance(true); $instance->phpunit_add_definition('phpunit/hashtest', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', diff --git a/cache/tests/cache_test.php b/cache/tests/cache_test.php index 37b8dea5d86..7c5d2ef2c90 100644 --- a/cache/tests/cache_test.php +++ b/cache/tests/cache_test.php @@ -47,7 +47,7 @@ class core_cache_testcase extends advanced_testcase { public function setUp() { parent::setUp(); cache_factory::reset(); - cache_config_phpunittest::create_default_configuration(); + cache_config_testing::create_default_configuration(); } /** @@ -114,9 +114,9 @@ class core_cache_testcase extends advanced_testcase { } $instance = cache_config::instance(); - $this->assertInstanceOf('cache_config_phpunittest', $instance); + $this->assertInstanceOf('cache_config_testing', $instance); - $this->assertTrue(cache_config_phpunittest::config_file_exists()); + $this->assertTrue(cache_config_testing::config_file_exists()); $stores = $instance->get_all_stores(); $this->assertCount(3, $stores); @@ -174,7 +174,7 @@ class core_cache_testcase extends advanced_testcase { * Tests for cache keys that would break on windows. */ public function test_windows_nasty_keys() { - $instance = cache_config_phpunittest::instance(); + $instance = cache_config_testing::instance(); $instance->phpunit_add_definition('phpunit/windowskeytest', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -195,7 +195,7 @@ class core_cache_testcase extends advanced_testcase { $this->assertInstanceOf('cache_application', $cache); $this->run_on_cache($cache); - $instance = cache_config_phpunittest::instance(true); + $instance = cache_config_testing::instance(true); $instance->phpunit_add_definition('phpunit/test_default_application_cache', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -230,7 +230,7 @@ class core_cache_testcase extends advanced_testcase { * Tests using a cache system when there are no stores available (who knows what the admin did to achieve this). */ public function test_on_cache_without_store() { - $instance = cache_config_phpunittest::instance(true); + $instance = cache_config_testing::instance(true); $instance->phpunit_add_definition('phpunit/nostoretest1', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -459,7 +459,7 @@ class core_cache_testcase extends advanced_testcase { * Tests a definition using a data loader */ public function test_definition_data_loader() { - $instance = cache_config_phpunittest::instance(true); + $instance = cache_config_testing::instance(true); $instance->phpunit_add_definition('phpunit/datasourcetest', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -500,7 +500,7 @@ class core_cache_testcase extends advanced_testcase { * Tests a definition using an overridden loader */ public function test_definition_overridden_loader() { - $instance = cache_config_phpunittest::instance(true); + $instance = cache_config_testing::instance(true); $instance->phpunit_add_definition('phpunit/overridetest', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -525,8 +525,8 @@ class core_cache_testcase extends advanced_testcase { * Test the mappingsonly setting. */ public function test_definition_mappings_only() { - /** @var cache_config_phpunittest $instance */ - $instance = cache_config_phpunittest::instance(true); + /** @var cache_config_testing $instance */ + $instance = cache_config_testing::instance(true); $instance->phpunit_add_definition('phpunit/mappingsonly', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -554,7 +554,7 @@ class core_cache_testcase extends advanced_testcase { * Test a very basic definition. */ public function test_definition() { - $instance = cache_config_phpunittest::instance(); + $instance = cache_config_testing::instance(); $instance->phpunit_add_definition('phpunit/test', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -572,7 +572,7 @@ class core_cache_testcase extends advanced_testcase { * Test a definition using the simple keys. */ public function test_definition_simplekeys() { - $instance = cache_config_phpunittest::instance(); + $instance = cache_config_testing::instance(); $instance->phpunit_add_definition('phpunit/simplekeytest', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -598,7 +598,7 @@ class core_cache_testcase extends advanced_testcase { * Test a negative TTL on an application cache. */ public function test_application_ttl_negative() { - $instance = cache_config_phpunittest::instance(true); + $instance = cache_config_testing::instance(true); $instance->phpunit_add_definition('phpunit/ttltest', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -647,7 +647,7 @@ class core_cache_testcase extends advanced_testcase { * Test a positive TTL on an application cache. */ public function test_application_ttl_positive() { - $instance = cache_config_phpunittest::instance(true); + $instance = cache_config_testing::instance(true); $instance->phpunit_add_definition('phpunit/ttltest', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -696,7 +696,7 @@ class core_cache_testcase extends advanced_testcase { * Test a negative TTL on an session cache. */ public function test_session_ttl_positive() { - $instance = cache_config_phpunittest::instance(true); + $instance = cache_config_testing::instance(true); $instance->phpunit_add_definition('phpunit/ttltest', array( 'mode' => cache_store::MODE_SESSION, 'component' => 'phpunit', @@ -745,7 +745,7 @@ class core_cache_testcase extends advanced_testcase { * Tests manual locking operations on an application cache */ public function test_application_manual_locking() { - $instance = cache_config_phpunittest::instance(); + $instance = cache_config_testing::instance(); $instance->phpunit_add_definition('phpunit/lockingtest', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -774,7 +774,7 @@ class core_cache_testcase extends advanced_testcase { * Tests application cache event invalidation */ public function test_application_event_invalidation() { - $instance = cache_config_phpunittest::instance(); + $instance = cache_config_testing::instance(); $instance->phpunit_add_definition('phpunit/eventinvalidationtest', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -809,7 +809,7 @@ class core_cache_testcase extends advanced_testcase { * Tests session cache event invalidation */ public function test_session_event_invalidation() { - $instance = cache_config_phpunittest::instance(); + $instance = cache_config_testing::instance(); $instance->phpunit_add_definition('phpunit/test_session_event_invalidation', array( 'mode' => cache_store::MODE_SESSION, 'component' => 'phpunit', @@ -845,7 +845,7 @@ class core_cache_testcase extends advanced_testcase { * Tests application cache definition invalidation */ public function test_application_definition_invalidation() { - $instance = cache_config_phpunittest::instance(); + $instance = cache_config_testing::instance(); $instance->phpunit_add_definition('phpunit/definitioninvalidation', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -881,7 +881,7 @@ class core_cache_testcase extends advanced_testcase { * Tests session cache definition invalidation */ public function test_session_definition_invalidation() { - $instance = cache_config_phpunittest::instance(); + $instance = cache_config_testing::instance(); $instance->phpunit_add_definition('phpunit/test_session_definition_invalidation', array( 'mode' => cache_store::MODE_SESSION, 'component' => 'phpunit', @@ -925,7 +925,7 @@ class core_cache_testcase extends advanced_testcase { // We need to add data the to cache, invalidate it by event, manually force it back without MUC knowing to simulate a // disconnected/distributed setup (think load balanced server using local cache), instantiate the cache again and finally // check that it is not picked up. - $instance = cache_config_phpunittest::instance(); + $instance = cache_config_testing::instance(); $instance->phpunit_add_definition('phpunit/eventinvalidationtest', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -963,7 +963,7 @@ class core_cache_testcase extends advanced_testcase { // Test 1: Rebuild without the event and test its there. cache_factory::reset(); - $instance = cache_config_phpunittest::instance(); + $instance = cache_config_testing::instance(); $instance->phpunit_add_definition('phpunit/eventinvalidationtest', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -976,7 +976,7 @@ class core_cache_testcase extends advanced_testcase { // Test 2: Rebuild and test the invalidation of the event via the invalidation cache. cache_factory::reset(); - $instance = cache_config_phpunittest::instance(); + $instance = cache_config_testing::instance(); $instance->phpunit_add_definition('phpunit/eventinvalidationtest', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -995,7 +995,7 @@ class core_cache_testcase extends advanced_testcase { * Tests application cache event purge */ public function test_application_event_purge() { - $instance = cache_config_phpunittest::instance(); + $instance = cache_config_testing::instance(); $instance->phpunit_add_definition('phpunit/eventpurgetest', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -1046,7 +1046,7 @@ class core_cache_testcase extends advanced_testcase { * Tests session cache event purge */ public function test_session_event_purge() { - $instance = cache_config_phpunittest::instance(); + $instance = cache_config_testing::instance(); $instance->phpunit_add_definition('phpunit/eventpurgetest', array( 'mode' => cache_store::MODE_SESSION, 'component' => 'phpunit', @@ -1097,7 +1097,7 @@ class core_cache_testcase extends advanced_testcase { * Tests application cache definition purge */ public function test_application_definition_purge() { - $instance = cache_config_phpunittest::instance(); + $instance = cache_config_testing::instance(); $instance->phpunit_add_definition('phpunit/definitionpurgetest', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -1132,7 +1132,7 @@ class core_cache_testcase extends advanced_testcase { } $this->resetAfterTest(); $CFG->altcacheconfigpath = $CFG->dataroot.'/cache/altcacheconfigpath'; - $instance = cache_config_phpunittest::instance(); + $instance = cache_config_testing::instance(); $this->assertInstanceOf('cache_config', $instance); } @@ -1140,7 +1140,7 @@ class core_cache_testcase extends advanced_testcase { * Test disabling the cache stores. */ public function test_disable_stores() { - $instance = cache_config_phpunittest::instance(); + $instance = cache_config_testing::instance(); $instance->phpunit_add_definition('phpunit/disabletest1', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -1269,14 +1269,14 @@ class core_cache_testcase extends advanced_testcase { $factory = cache_factory::instance(true); $config = $factory->create_config_instance(); - $this->assertEquals('cache_config_phpunittest', get_class($config)); + $this->assertEquals('cache_config_testing', get_class($config)); } /** * Test that multiple application loaders work ok. */ public function test_multiple_application_loaders() { - $instance = cache_config_phpunittest::instance(true); + $instance = cache_config_testing::instance(true); $instance->phpunit_add_file_store('phpunittest1'); $instance->phpunit_add_file_store('phpunittest2'); $instance->phpunit_add_definition('phpunit/multi_loader', array( @@ -1344,8 +1344,8 @@ class core_cache_testcase extends advanced_testcase { * Test that multiple application loaders work ok. */ public function test_multiple_session_loaders() { - /* @var cache_config_phpunittest $instance */ - $instance = cache_config_phpunittest::instance(true); + /* @var cache_config_testing $instance */ + $instance = cache_config_testing::instance(true); $instance->phpunit_add_session_store('phpunittest1'); $instance->phpunit_add_session_store('phpunittest2'); $instance->phpunit_add_definition('phpunit/multi_loader', array( @@ -1442,7 +1442,7 @@ class core_cache_testcase extends advanced_testcase { */ public function test_session_cache_switch_user_application_mapping() { $this->resetAfterTest(true); - $instance = cache_config_phpunittest::instance(true); + $instance = cache_config_testing::instance(true); $instance->phpunit_add_file_store('testfilestore'); $instance->phpunit_add_definition('phpunit/testappsession', array( 'mode' => cache_store::MODE_SESSION, @@ -1477,7 +1477,7 @@ class core_cache_testcase extends advanced_testcase { * Test two session caches being used at once to confirm collisions don't occur. */ public function test_dual_session_caches() { - $instance = cache_config_phpunittest::instance(true); + $instance = cache_config_testing::instance(true); $instance->phpunit_add_definition('phpunit/testsess1', array( 'mode' => cache_store::MODE_SESSION, 'component' => 'phpunit', @@ -1542,7 +1542,7 @@ class core_cache_testcase extends advanced_testcase { * Test application locking. */ public function test_application_locking() { - $instance = cache_config_phpunittest::instance(true); + $instance = cache_config_testing::instance(true); $instance->phpunit_add_definition('phpunit/test_application_locking', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -1568,7 +1568,7 @@ class core_cache_testcase extends advanced_testcase { * Test the static cache_helper method purge_stores_used_by_definition. */ public function test_purge_stores_used_by_definition() { - $instance = cache_config_phpunittest::instance(true); + $instance = cache_config_testing::instance(true); $instance->phpunit_add_definition('phpunit/test_purge_stores_used_by_definition', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -1590,7 +1590,7 @@ class core_cache_testcase extends advanced_testcase { * Test purge routines. */ public function test_purge_routines() { - $instance = cache_config_phpunittest::instance(true); + $instance = cache_config_testing::instance(true); $instance->phpunit_add_definition('phpunit/purge1', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -1637,7 +1637,7 @@ class core_cache_testcase extends advanced_testcase { * Test that the default stores all support searching. */ public function test_defaults_support_searching() { - $instance = cache_config_phpunittest::instance(true); + $instance = cache_config_testing::instance(true); $instance->phpunit_add_definition('phpunit/search1', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', @@ -1684,7 +1684,7 @@ class core_cache_testcase extends advanced_testcase { } public function test_static_acceleration() { - $instance = cache_config_phpunittest::instance(); + $instance = cache_config_testing::instance(); $instance->phpunit_add_definition('phpunit/accelerated', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', diff --git a/cache/tests/config_writer_test.php b/cache/tests/config_writer_test.php index f49f65ee317..12b6291ed75 100644 --- a/cache/tests/config_writer_test.php +++ b/cache/tests/config_writer_test.php @@ -47,7 +47,7 @@ class core_cache_config_writer_testcase extends advanced_testcase { public function setUp() { parent::setUp(); cache_factory::reset(); - cache_config_phpunittest::create_default_configuration(); + cache_config_testing::create_default_configuration(); } /** @@ -261,7 +261,7 @@ class core_cache_config_writer_testcase extends advanced_testcase { * Test setting some definition mappings. */ public function test_set_definition_mappings() { - $config = cache_config_phpunittest::instance(true); + $config = cache_config_testing::instance(true); $config->phpunit_add_definition('phpunit/testdefinition', array( 'mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', diff --git a/cache/tests/fixtures/lib.php b/cache/tests/fixtures/lib.php index 3f671a31b8a..8b3ef558964 100644 --- a/cache/tests/fixtures/lib.php +++ b/cache/tests/fixtures/lib.php @@ -31,12 +31,16 @@ defined('MOODLE_INTERNAL') || die(); require_once($CFG->dirroot.'/cache/locallib.php'); /** - * Override the default cache configuration for our own maniacle purposes. + * Override the default cache configuration for our own maniacal purposes. * - * @copyright 2012 Sam Hemelryk - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * This class was originally named cache_config_phpunittest but was renamed in 2.9 + * because it is used for both unit tests and acceptance tests. + * + * @since 2.9 + * @copyright 2012 Sam Hemelryk + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cache_config_phpunittest extends cache_config_writer { +class cache_config_testing extends cache_config_writer { /** * Creates the default configuration and saves it. @@ -135,10 +139,10 @@ class cache_config_phpunittest extends cache_config_writer { if (!empty($CFG->altcacheconfigpath)) { - if (defined('PHPUNIT_TEST') && PHPUNIT_TEST && - (!defined('TEST_CACHE_USING_ALT_CACHE_CONFIG_PATH') || !TEST_CACHE_USING_ALT_CACHE_CONFIG_PATH)) { - // We're within a unit test, but TEST_CACHE_USING_ALT_CACHE_CONFIG_PATH has not being defined or is - // false, we want to use the default. + // No need to check we are within a test here, this is the cache config class that gets used + // only when one of those is true. + if (!defined('TEST_CACHE_USING_ALT_CACHE_CONFIG_PATH') || !TEST_CACHE_USING_ALT_CACHE_CONFIG_PATH) { + // TEST_CACHE_USING_ALT_CACHE_CONFIG_PATH has not being defined or is false, we want to use the default. return $configpath; } @@ -286,6 +290,21 @@ class cache_config_phpunittest extends cache_config_writer { } } +/** + * This is a deprecated class. It has been renamed to cache_config_testing. + * + * This was deprecated in Moodle 2.9 but will be removed at the next major release + * as it is only used during testing and its highly unlikely anyone has used this. + * + * @deprecated since 2.9 + * @copyright 2014 Sam Hemelryk + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class cache_config_phpunittest extends cache_config_testing { + // We can't do anything here to warn the user. + // The cache can be utilised before sessions have even been started. +} + /** * Dummy object for testing cacheable object interface and interaction * diff --git a/cache/upgrade.txt b/cache/upgrade.txt index c1707c0664e..760438eb019 100644 --- a/cache/upgrade.txt +++ b/cache/upgrade.txt @@ -10,6 +10,7 @@ Information provided here is intended especially for developers. - cache_definition::load Argument 3 (final arg) is now unused. - cache_factory::create_cache_from_definition Argument 4 (final arg) is now unused. - cache::make Argument 4 (final arg) is now unused. +* cache_config_phpunittest has been renamed to cache_config_testing * New method cache_store::ready_to_be_used_for_testing() that returns true|false if the store is suitable and ready for use as the primary store during unit and acceptance tests. === 2.7 === diff --git a/lib/behat/lib.php b/lib/behat/lib.php index e32bbb52465..4cb883f19b4 100644 --- a/lib/behat/lib.php +++ b/lib/behat/lib.php @@ -155,7 +155,8 @@ function behat_clean_init_config() { 'wwwroot', 'dataroot', 'dirroot', 'admin', 'directorypermissions', 'filepermissions', 'umaskpermissions', 'dbtype', 'dblibrary', 'dbhost', 'dbname', 'dbuser', 'dbpass', 'prefix', 'dboptions', 'proxyhost', 'proxyport', 'proxytype', 'proxyuser', 'proxypassword', - 'proxybypass', 'theme', 'pathtogs', 'pathtoclam', 'pathtodu', 'aspellpath', 'pathtodot', 'skiplangupgrade' + 'proxybypass', 'theme', 'pathtogs', 'pathtoclam', 'pathtodu', 'aspellpath', 'pathtodot', 'skiplangupgrade', + 'altcacheconfigpath' )); // Add extra allowed settings.