Skip to content

Commit

Permalink
MBS-7802: Changes due to failing core unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PM84 committed May 31, 2024
1 parent d4f9100 commit 644c2af
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
26 changes: 18 additions & 8 deletions classes/frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,15 @@ protected function get_javascript_init_params($course, \cm_info $cm = null, \sec
];
}

$roles = explode(',', get_config('availability_role', 'coursecatroles'));
foreach ($roles as $rec) {
$rec = $DB->get_record('role', ['id' => $rec]);
if (empty($rec->id)) continue;
$roleids = explode(',', get_config('availability_role', 'coursecatroles'));
foreach ($roleids as $roleid) {
if(empty($roleid)){
continue;
}
$rec = $DB->get_record('role', ['id' => $roleid]);
if (empty($rec->id)) {
continue;
}
$jsarray[] = (object)[
'id' => $rec->id,
'name' => (!empty($rec->name) ? $rec->name : $rec->shortname),
Expand All @@ -79,10 +84,15 @@ protected function get_javascript_init_params($course, \cm_info $cm = null, \sec
];
}

$roles = explode(',', get_config('availability_role', 'globalroles'));
foreach ($roles as $rec) {
$rec = $DB->get_record('role', ['id' => $rec]);
if (empty($rec->id)) continue;
$roleids = explode(',', get_config('availability_role', 'globalroles'));
foreach ($roleids as $roleid) {
if (empty($roleid)) {
continue;
}
$rec = $DB->get_record('role', ['id' => $roleid]);
if (empty($rec->id)) {
continue;
}
$jsarray[] = (object)[
'id' => $rec->id,
'name' => (!empty($rec->name) ? $rec->name : $rec->shortname),
Expand Down
1 change: 1 addition & 0 deletions tests/condition_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public function test_save() {
$structure = (object)['id' => 123];
$cond = new condition($structure);
$structure->type = 'role';
$structure->typeid = 0;
$this->assertEquals($structure, $cond->save());
}
}

0 comments on commit 644c2af

Please sign in to comment.