Merge branch 'MDL-85400-404' of https://github.com/lameze/moodle into MOODLE_404_STABLE

This commit is contained in:
Huong Nguyen
2025-05-29 09:00:03 +07:00
2 changed files with 2 additions and 21 deletions
+2 -2
View File
@@ -80,8 +80,8 @@ class encryption {
throw new \moodle_exception('encryption_keyalreadyexists', 'error');
}
// Don't make it read-only in Behat or it will fail to clear for future runs.
if (defined('BEHAT_SITE_RUNNING')) {
// Don't make it read-only in tests or it will fail to clear for future runs.
if (defined('BEHAT_SITE_RUNNING') || PHPUNIT_TEST) {
$chmod = false;
}
-19
View File
@@ -28,26 +28,7 @@ use advanced_testcase;
*/
final class encryption_test extends advanced_testcase {
/**
* Clear junk created by tests.
*/
protected function tearDown(): void {
global $CFG;
$keyfile = encryption::get_key_file(encryption::METHOD_OPENSSL);
if (file_exists($keyfile)) {
chmod($keyfile, 0700);
}
$keyfile = encryption::get_key_file(encryption::METHOD_SODIUM);
if (file_exists($keyfile)) {
chmod($keyfile, 0700);
}
remove_dir($CFG->dataroot . '/secret');
unset($CFG->nokeygeneration);
}
protected function setUp(): void {
$this->tearDown();
require_once(__DIR__ . '/fixtures/testable_encryption.php');
}