Commit bfaf4f00 authored by Petr Škoda's avatar Petr Škoda
Browse files

MDL-43903 prevent adodb error logging output in phpunit execution with

native ms sql driver
parent 7e3f5e79
......@@ -28,11 +28,17 @@ defined('MOODLE_INTERNAL') || die();
class auth_db_testcase extends advanced_testcase {
/** @var string Original error log */
protected $oldlog;
protected function init_auth_database() {
global $DB, $CFG;
require_once("$CFG->dirroot/auth/db/auth.php");
// Discard error logs from AdoDB.
$this->oldlog = ini_get('error_log');
ini_set('error_log', "$CFG->dataroot/testlog.log");
$dbman = $DB->get_manager();
set_config('extencoding', 'utf-8', 'auth/db');
......@@ -133,6 +139,8 @@ class auth_db_testcase extends advanced_testcase {
$dbman = $DB->get_manager();
$table = new xmldb_table('auth_db_users');
$dbman->drop_table($table);
ini_set('error_log', $this->oldlog);
}
public function test_plugin() {
......
......@@ -31,9 +31,16 @@ class enrol_database_testcase extends advanced_testcase {
protected static $users = array();
protected static $roles = array();
/** @var string Original error log */
protected $oldlog;
protected function init_enrol_database() {
global $DB, $CFG;
// Discard error logs from AdoDB.
$this->oldlog = ini_get('error_log');
ini_set('error_log', "$CFG->dataroot/testlog.log");
$dbman = $DB->get_manager();
set_config('dbencoding', 'utf-8', 'enrol_database');
......@@ -160,6 +167,8 @@ class enrol_database_testcase extends advanced_testcase {
self::$courses = null;
self::$users = null;
self::$roles = null;
ini_set('error_log', $this->oldlog);
}
protected function reset_enrol_database() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment