Skip to content

Commit

Permalink
PHPUnit fix for failing enrol_dbuserrel_testcase::test_readrelationsh…
Browse files Browse the repository at this point in the history
…ips (#5)

* added mariadb switch to mysqli

* Fixed risky test by disabling debugdb in testcase

---------

Co-authored-by: dragos5436 <[email protected]>
  • Loading branch information
dragos5436 and dragos5436 authored Aug 7, 2023
1 parent 2e78ccf commit ee6cf84
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions classes/dataport_external.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ private function init_external_db($host, $dbname, $dbtype, $username, $password,
require_once($CFG->libdir.'/adodb/adodb.inc.php');

// Connect to the external database (forcing new connection).
if ($dbtype === 'mariadb') {
$dbtype = 'mysqli' ;
}
$extdb = ADONewConnection($dbtype);
if ($debug) {
$extdb->debug = true;
Expand Down
2 changes: 1 addition & 1 deletion tests/dbuserrel_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function test_readrelationships() {
$this->dbuserrelplugin->set_config('remotesubjectuserfield', 'remote_subject_id');
$this->dbuserrelplugin->set_config('remoteobjectuserfield', 'remote_object_id');
$this->dbuserrelplugin->set_config('remoterolefield', 'remote_role');
$this->dbuserrelplugin->set_config('debugdb', true);
$this->dbuserrelplugin->set_config('debugdb', false);

$this->dbuserrelplugin->set_config('localsubjectuserfield', 'user_idnumber');
$this->dbuserrelplugin->set_config('localobjectuserfield', 'user_idnumber');
Expand Down

0 comments on commit ee6cf84

Please sign in to comment.