mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
MDL-43903 prevent adodb error logging output in phpunit execution with
native ms sql driver
This commit is contained in:
parent
7e3f5e79d0
commit
bfaf4f00cb
@ -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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user