This commit is contained in:
Ilya Tregubov 2024-04-17 11:11:21 +08:00
commit 053506035a
2 changed files with 10 additions and 12 deletions

View File

@ -254,7 +254,7 @@ class course_test extends \advanced_testcase {
$data = ['shortname' => 'newcourse', 'fullname' => 'New course', 'summary' => 'New', 'category' => 1];
$co = new tool_uploadcourse_course($mode, $updatemode, $data);
if (in_array($role->shortname, $rolesallowed)) {
if (in_array($role->archetype, $rolesallowed)) {
$this->assertTrue($co->prepare());
$co->proceed();
$courseid = $DB->get_field('course', 'id', ['shortname' => 'newcourse'], MUST_EXIST);

View File

@ -59,17 +59,15 @@ class repository_equella_generator extends testing_repository_generator {
if (!isset($record['equella_sharedsecret'])) {
$record['equella_sharedsecret'] = 'secret';
}
if (!isset($record['equella_manager_shareid'])) {
$record['equella_manager_shareid'] = '';
}
if (!isset($record['equella_manager_sharedsecret'])) {
$record['equella_manager_sharedsecret'] = '';
}
if (!isset($record['equella_editingteacher_shareid'])) {
$record['equella_editingteacher_shareid'] = '';
}
if (!isset($record['equella_editingteacher_sharedsecret'])) {
$record['equella_editingteacher_sharedsecret'] = '';
// Set defaults for all generated options for each role with editing capabilities.
$editingroles = get_roles_with_capability('moodle/course:manageactivities', CAP_ALLOW);
foreach ($editingroles as $role) {
if (!isset($record["equella_{$role->shortname}_shareid"])) {
$record["equella_{$role->shortname}_shareid"] = '';
}
if (!isset($record["equella_{$role->shortname}_sharedsecret"])) {
$record["equella_{$role->shortname}_sharedsecret"] = '';
}
}
return $record;
}