Skip to content

Commit

Permalink
MDL-43903 prevent adodb error logging output in phpunit execution with
Browse files Browse the repository at this point in the history
native ms sql driver
  • Loading branch information
skodak committed Jan 30, 2014
1 parent 7e3f5e7 commit bfaf4f0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions auth/db/tests/db_test.php
Expand Up @@ -28,11 +28,17 @@


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');
Expand Down Expand Up @@ -133,6 +139,8 @@ protected function cleanup_auth_database() {
$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() {
Expand Down
9 changes: 9 additions & 0 deletions enrol/database/tests/sync_test.php
Expand Up @@ -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');
Expand Down Expand Up @@ -160,6 +167,8 @@ protected function cleanup_enrol_database() {
self::$courses = null;
self::$users = null;
self::$roles = null;

ini_set('error_log', $this->oldlog);
}

protected function reset_enrol_database() {
Expand Down

0 comments on commit bfaf4f0

Please sign in to comment.