Merge branch 'MDL-84124-405' of https://github.com/andrewnicols/moodle into MOODLE_405_STABLE

This commit is contained in:
Jun Pataleta 2025-01-14 11:12:24 +08:00
commit 9ed5fcd1f8
No known key found for this signature in database
GPG Key ID: F83510526D99E2C7

View File

@ -37,10 +37,10 @@ require_once(__DIR__.'/../lib.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
final class compressor_test extends \advanced_testcase {
/** @var null|\cachestore_redis */
protected ?cachestore_redis $store = null;
/**
* Test set up
*/
#[\Override]
public function setUp(): void {
if (!cachestore_redis::are_requirements_met() || !defined('TEST_CACHESTORE_REDIS_TESTSERVERS')) {
$this->markTestSkipped('Could not test cachestore_redis. Requirements are not met.');
@ -49,6 +49,16 @@ final class compressor_test extends \advanced_testcase {
parent::setUp();
}
#[\Override]
protected function tearDown(): void {
parent::tearDown();
if ($this->store !== null) {
$this->store->purge();
$this->store = null;
}
}
/**
* Create a cachestore.
*
@ -64,6 +74,7 @@ final class compressor_test extends \advanced_testcase {
$config['serializer'] = $serializer;
$store = new cachestore_redis('Test', $config);
$store->initialise($definition);
$this->store = $store;
return $store;
}