diff --git a/auth/db/tests/db_test.php b/auth/db/tests/db_test.php index 3b9d726f8df..606dc51945b 100644 --- a/auth/db/tests/db_test.php +++ b/auth/db/tests/db_test.php @@ -34,6 +34,17 @@ class auth_db_testcase extends advanced_testcase { /** @var int The amount of users to create for the large user set deletion test */ protected $largedeletionsetsize = 128; + public static function tearDownAfterClass(): void { + global $DB; + // Apply sqlsrv native driver error and logging default + // settings while finishing the AdoDB tests. + if ($DB->get_dbfamily() === 'mssql') { + sqlsrv_configure("WarningsReturnAsErrors", false); + sqlsrv_configure("LogSubsystems", SQLSRV_LOG_SYSTEM_OFF); + sqlsrv_configure("LogSeverity", SQLSRV_LOG_SEVERITY_ERROR); + } + } + protected function init_auth_database() { global $DB, $CFG; require_once("$CFG->dirroot/auth/db/auth.php"); diff --git a/enrol/database/tests/lib_test.php b/enrol/database/tests/lib_test.php index 8ef5cfb1be6..d9f1b439fab 100644 --- a/enrol/database/tests/lib_test.php +++ b/enrol/database/tests/lib_test.php @@ -36,6 +36,18 @@ defined('MOODLE_INTERNAL') || die(); * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class lib_test extends \advanced_testcase { + + public static function tearDownAfterClass(): void { + global $DB; + // Apply sqlsrv native driver error and logging default + // settings while finishing the AdoDB tests. + if ($DB->get_dbfamily() === 'mssql') { + sqlsrv_configure("WarningsReturnAsErrors", false); + sqlsrv_configure("LogSubsystems", SQLSRV_LOG_SYSTEM_OFF); + sqlsrv_configure("LogSeverity", SQLSRV_LOG_SEVERITY_ERROR); + } + } + /** * Test for getting user enrolment actions. */ diff --git a/enrol/database/tests/sync_test.php b/enrol/database/tests/sync_test.php index 81634ab435b..061c29b8d71 100644 --- a/enrol/database/tests/sync_test.php +++ b/enrol/database/tests/sync_test.php @@ -35,6 +35,17 @@ class sync_test extends \advanced_testcase { /** @var string Original error log */ protected $oldlog; + public static function tearDownAfterClass(): void { + global $DB; + // Apply sqlsrv native driver error and logging default + // settings while finishing the AdoDB tests. + if ($DB->get_dbfamily() === 'mssql') { + sqlsrv_configure("WarningsReturnAsErrors", false); + sqlsrv_configure("LogSubsystems", SQLSRV_LOG_SYSTEM_OFF); + sqlsrv_configure("LogSeverity", SQLSRV_LOG_SEVERITY_ERROR); + } + } + protected function init_enrol_database() { global $DB, $CFG;