diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..db2a88a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,45 @@ +language: php + +sudo: false + +cache: + directories: + - $HOME/.composer/cache + +php: + - 5.6 + - 7.0 + +env: + global: + - MOODLE_BRANCH=MOODLE_31_STABLE + - IGNORE_PATHS=amd/src/list.js + + + matrix: + - DB=pgsql + - DB=mysqli + +before_install: + - phpenv config-rm xdebug.ini + - cd ../.. + - composer selfupdate + - composer create-project -n --no-dev --prefer-dist moodlerooms/moodle-plugin-ci ci dev-poet + - export PATH="$(cd ci/bin; pwd):$(cd ci/vendor/bin; pwd):$PATH" + +install: + - moodle-plugin-ci install + +script: + - moodle-plugin-ci phplint + - moodle-plugin-ci phpcpd + - moodle-plugin-ci phpmd + - moodle-plugin-ci codechecker + - moodle-plugin-ci codechecker --standard poet + - moodle-plugin-ci csslint + - moodle-plugin-ci shifter + - moodle-plugin-ci jshint + - moodle-plugin-ci validate + - moodle-plugin-ci phpunit + - moodle-plugin-ci behat + - moodle-plugin-ci phpunit --coverage-text \ No newline at end of file diff --git a/block_grade_me.php b/block_grade_me.php index e84ee17..02c0f43 100644 --- a/block_grade_me.php +++ b/block_grade_me.php @@ -25,7 +25,6 @@ class block_grade_me extends block_base { public function init() { - global $CFG; $this->title = get_string('pluginname', 'block_grade_me', array()); } @@ -48,7 +47,7 @@ public function get_content() { $PAGE->requires->jquery(); $PAGE->requires->js('/blocks/grade_me/javascript/grademe.js'); - // create the content class + // Create the content class. $this->content = new stdClass; $this->content->text = ''; $this->content->footer = ''; @@ -57,11 +56,9 @@ public function get_content() { return $this->content; } - // setup arrays - $grader = array(); + // Setup arrays. $gradeables = array(); - $excess = false; $groups = null; $enabledplugins = block_grade_me_enabled_plugins(); @@ -85,15 +82,18 @@ public function get_content() { $gradeables = array(); $gradebookusers = array(); $context = context_course::instance($courseid); - foreach (explode(',', $CFG->gradebookroles) AS $roleid) { + foreach (explode(',', $CFG->gradebookroles) as $roleid) { $roleid = trim($roleid); - if (groups_get_course_groupmode($course) == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $context)) { + if ((groups_get_course_groupmode($course) == SEPARATEGROUPS) && + !has_capability('moodle/site:accessallgroups', $context)) { $groups = groups_get_user_groups($courseid, $USER->id); foreach ($groups[0] as $groupid) { - $gradebookusers = array_merge($gradebookusers, array_keys(get_role_users($roleid, $context, false, 'u.id', 'u.id ASC', null, $groupid))); + $gradebookusers = array_merge($gradebookusers, + array_keys(get_role_users($roleid, $context, false, 'u.id', 'u.id ASC', null, $groupid))); } } else { - $gradebookusers = array_merge($gradebookusers, array_keys(get_role_users($roleid, $context, false, 'u.id', 'u.id ASC'))); + $gradebookusers = array_merge($gradebookusers, + array_keys(get_role_users($roleid, $context, false, 'u.id', 'u.id ASC'))); } } @@ -135,7 +135,7 @@ public function get_content() { } } foreach ($graderroles as $roleid => $value) { - if (user_has_role_assignment($USER->id, $roleid) or is_siteadmin()) { + if (user_has_role_assignment($USER->id, $roleid) || is_siteadmin()) { $showempty = true; } else { $showempty = false; @@ -144,7 +144,8 @@ public function get_content() { if (!empty($this->content->text)) { // Expand/Collapse button. - $expand = ''; + $expand = ''; $this->content->text = '
'.$expand.$this->content->text.'
'.$additional.'
'; } else if (empty($this->content->text) && $showempty) { @@ -163,7 +164,7 @@ public function cron() { global $CFG, $DB; require_once($CFG->dirroot.'/blocks/grade_me/lib.php'); - // We are going to measure execution times + // We are going to measure execution times. $starttime = microtime(); $params = array(); @@ -193,7 +194,8 @@ public function cron() { 'iteminstance' => $rec->iteminstance, 'courseid' => $rec->courseid ); - $fragment = 'itemtype = :itemtype AND itemmodule = :itemmodule AND iteminstance = :iteminstance AND courseid = :courseid'; + $fragment = 'itemtype = :itemtype AND itemmodule = :itemmodule AND '. + 'iteminstance = :iteminstance AND courseid = :courseid'; $params = array( 'itemname' => $rec->itemname, 'itemtype' => $rec->itemtype, @@ -215,7 +217,7 @@ public function cron() { } } - // Show times + // Show times. mtrace(''); mtrace('Updated block_grade_me cache in ' . microtime_diff($starttime, microtime()) . ' seconds'); } diff --git a/classes/quiz_observers.php b/classes/quiz_observers.php index 5a52934..5d3e4e5 100644 --- a/classes/quiz_observers.php +++ b/classes/quiz_observers.php @@ -108,7 +108,8 @@ public static function question_manually_graded($event) { $count = $DB->get_record_sql($sql, [$event->other['attemptid']]); // Delete attempts if all questions are graded for attempt, leave other attempts by user for quiz untouched. if (empty($count->attempts)) { - $DB->delete_records('block_grade_me_quiz_ngrade', ['attemptid' => $event->other['attemptid'], 'quizid' => $event->other['quizid']]); + $DB->delete_records('block_grade_me_quiz_ngrade', + ['attemptid' => $event->other['attemptid'], 'quizid' => $event->other['quizid']]); } } } \ No newline at end of file diff --git a/classes/quiz_util.php b/classes/quiz_util.php index 40b7d51..8a87f90 100644 --- a/classes/quiz_util.php +++ b/classes/quiz_util.php @@ -41,7 +41,8 @@ public static function update_quiz_ngrade($attemptid = null) { $attemptsql = "AND qna1.questionusageid = (SELECT uniqueid FROM {quiz_attempts} WHERE id = ?)"; $params[] = $attemptid; } - $sql = "INSERT INTO {block_grade_me_quiz_ngrade} ( attemptid, userid, quizid, questionattemptstepid, courseid ) SELECT qza.uniqueid, qza.userid, qza.quiz, qas.id, q.course + $sql = "INSERT INTO {block_grade_me_quiz_ngrade} ( attemptid, userid, quizid, questionattemptstepid, courseid ) + SELECT qza.uniqueid, qza.userid, qza.quiz, qas.id, q.course FROM {question_attempt_steps} qas JOIN {question_attempts} qna ON qas.questionattemptid = qna.id JOIN {quiz_attempts} qza ON qna.questionusageid = qza.uniqueid diff --git a/db/upgrade.php b/db/upgrade.php index ab16c35..6293281 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -61,7 +61,7 @@ function xmldb_block_grade_me_upgrade($oldversion, $block) { } - // grade_me savepoint reached + // Grade_me savepoint reached. upgrade_block_savepoint(true, 2013022600, 'grade_me'); } diff --git a/lib.php b/lib.php index 799c3f0..119f5c6 100644 --- a/lib.php +++ b/lib.php @@ -39,7 +39,8 @@ function block_grade_me_array2str($array) { * @return string $query */ function block_grade_me_query_prefix() { - $query = 'SELECT bgm.courseid, bgm.coursename, bgm.itemmodule, bgm.iteminstance, bgm.itemname, bgm.coursemoduleid, bgm.itemsortorder'; + $query = 'SELECT bgm.courseid, bgm.coursename, bgm.itemmodule, bgm.iteminstance, bgm.itemname, ' . + 'bgm.coursemoduleid, bgm.itemsortorder'; return $query; } @@ -65,7 +66,7 @@ function block_grade_me_enabled_plugins() { $plugins = get_list_of_plugins('blocks/grade_me/plugins'); foreach ($plugins as $plugin) { if (file_exists($CFG->dirroot.'/blocks/grade_me/plugins/'.$plugin.'/'.$plugin.'_plugin.php') - and $CFG->{'block_grade_me_enable'.$plugin} == true) { + && ($CFG->{'block_grade_me_enable'.$plugin} == true)) { include_once($CFG->dirroot.'/blocks/grade_me/plugins/'.$plugin.'/'.$plugin.'_plugin.php'); if (function_exists('block_grade_me_required_capability_'.$plugin)) { $requiredcapability = 'block_grade_me_required_capability_'.$plugin; @@ -104,11 +105,11 @@ function block_grade_me_array($gradeables, $r) { function block_grade_me_tree($course) { global $CFG, $DB, $OUTPUT, $SESSION; - // get time format string + // Get time format string. $datetimestring = get_string('datetime', 'block_grade_me', array()); - // Grading image + // Grading image. $gradeimg = $CFG->wwwroot.'/blocks/grade_me/pix/check_mark.png'; - // Define text variable + // Define text variable. $text = ''; $courseid = $course['meta']['courseid']; @@ -132,8 +133,7 @@ function block_grade_me_tree($course) { ksort($course); - foreach ($course as $l2 => $item) { - $iteminstance = $item['meta']['iteminstance']; + foreach ($course as $item) { $itemmodule = $item['meta']['itemmodule']; $itemname = $item['meta']['itemname']; $coursemoduleid = $item['meta']['coursemoduleid']; @@ -148,11 +148,10 @@ function block_grade_me_tree($course) { } else { $gradelink = $modulelink; } - $moduleimgtitle = get_string('link_mod_img', 'block_grade_me', array('mod_name' => $itemmodule)); $moduletitle = get_string('link_mod', 'block_grade_me', array('mod_name' => $itemmodule)); $moduleicon = $OUTPUT->pix_icon('icon', $moduletitle, $itemmodule, array('class' => 'gm_icon')); - $text .= '
'."\n"; // open module + $text .= '
'."\n"; // Open module. $text .= '
'."\n"; @@ -163,7 +162,7 @@ function block_grade_me_tree($course) { ksort($item); - // Assign module needs to have a rownum and useridlist + // Assign module needs to have a rownum and useridlist. $rownum = 0; $useridlistid = $coursemoduleid.time(); $useridlist = array(); @@ -175,7 +174,8 @@ function block_grade_me_tree($course) { $submissionlink = $CFG->wwwroot; if ($itemmodule == 'assignment') { - $submissionlink .= '/mod/assignment/submissions.php?id='.$coursemoduleid.'&userid='.$userid.'&mode=single&filter=0&offset=0'; + $submissionlink .= '/mod/assignment/submissions.php?id='.$coursemoduleid.'&userid=' . $userid . + '&mode=single&filter=0&offset=0'; } else if ($itemmodule == 'assign') { $submissionlink .= "/mod/assign/view.php?id=$coursemoduleid&action=grade&rownum=$rownum&useridlistid=$useridlistid"; $rownum++; @@ -202,14 +202,14 @@ function block_grade_me_tree($course) { $userfirstlast = $user->firstname.' '.$user->lastname; $userprofiletitle = get_string('link_user_profile', 'block_grade_me', array('first_name' => $userfirst)); - $text .= '
  • '; // open gradable + $text .= '
  • '; // Open gradable. $text .= ''.$altmark.''; // grade icon + '" class="gm_icon" alt="'.$altmark.'" />'; // Grade icon. $text .= $OUTPUT->user_picture($user, array('size' => 16, 'courseid' => $courseid, 'link' => true)); $text .= ''.$userfirstlast.''; // user name and profile link - $text .= '
    '.userdate($timesubmitted, $datetimestring); // output submission date - $text .= '
  • '."\n"; // end gradable + $courseid.'" title="'.$userprofiletitle.'">'.$userfirstlast.''; // User name and profile link. + $text .= '
    '.userdate($timesubmitted, $datetimestring); // Output submission date. + $text .= ''."\n"; // End gradable. } if ($itemmodule == 'assign') { @@ -218,7 +218,7 @@ function block_grade_me_tree($course) { } $text .= ''."\n"; - $text .= '
    '."\n"; // close module + $text .= ''."\n"; // Close module. } $text .= ''; diff --git a/plugins/assign/assign_plugin.php b/plugins/assign/assign_plugin.php index eebc588..a79a4df 100644 --- a/plugins/assign/assign_plugin.php +++ b/plugins/assign/assign_plugin.php @@ -52,7 +52,8 @@ function block_grade_me_query_assign($gradebookusers) { FROM {assign_submission} asgn_sub JOIN {assign} a ON a.id = asgn_sub.assignment LEFT JOIN {block_grade_me} bgm ON bgm.courseid = a.course AND bgm.iteminstance = a.id - LEFT JOIN {assign_grades} ag ON ag.assignment = asgn_sub.assignment AND ag.userid = asgn_sub.userid AND asgn_sub.attemptnumber = ag.attemptnumber + LEFT JOIN {assign_grades} ag ON ag.assignment = asgn_sub.assignment AND ag.userid = asgn_sub.userid AND + asgn_sub.attemptnumber = ag.attemptnumber WHERE asgn_sub.userid $insql AND asgn_sub.status = 'submitted' AND a.grade <> 0 AND (ag.id IS NULL OR asgn_sub.timemodified > ag.timemodified)"; diff --git a/settings.php b/settings.php index df7f6e7..cc6507d 100644 --- a/settings.php +++ b/settings.php @@ -18,8 +18,8 @@ if ($ADMIN->fulltree) { - $settings->add(new admin_setting_configcheckbox('block_grade_me_enableadminviewall', get_string('settings_adminviewall', 'block_grade_me'), - get_string('settings_configadminviewall', 'block_grade_me'), 0)); + $settings->add(new admin_setting_configcheckbox('block_grade_me_enableadminviewall', + get_string('settings_adminviewall', 'block_grade_me'), get_string('settings_configadminviewall', 'block_grade_me'), 0)); $settings->add(new admin_setting_configtext('block_grade_me_maxcourses', get_string('settings_maxcourses', 'block_grade_me'), get_string('settings_configmaxcourses', 'block_grade_me'), 10, PARAM_INT)); diff --git a/styles.css b/styles.css index 85d037e..2c3b3e4 100644 --- a/styles.css +++ b/styles.css @@ -8,16 +8,16 @@ .block_grade_me dd, .block_grade_me ul, .block_grade_me li { + list-style: none; margin: 0; padding: 0; - list-style: none; } .block_grade_me .gm_icon { - width: 16px; - height: 16px; float: left; + height: 16px; margin-right: 4px; + width: 16px; } .block_grade_me .cmod { @@ -27,19 +27,19 @@ .block_grade_me .module { line-height: 16px; - position: relative; padding: 3px 0 3px 20px; + position: relative; } .block_grade_me .toggle { - position: relative; - left: 0; + background: transparent url('[[pix:block_grade_me|closed]]') no-repeat 50% 50%; + cursor: pointer; display: block; - width: 16px; - height: 16px; float: left; - cursor: pointer; - background: transparent url('[[pix:block_grade_me|closed]]') no-repeat 50% 50%; + height: 16px; + left: 0; + position: relative; + width: 16px; } .block_grade_me .toggle.open { @@ -51,14 +51,14 @@ } .block_grade_me .cloakable { + border-top: 1px dotted #ccc; line-height: 1em; margin: 0 0 3px 0; - border-top: 1px dotted #ccc; } .block_grade_me .gradable { - padding: 2px 0; border-bottom: 1px dotted #ccc; + padding: 2px 0; } .block_grade_me .gradable .gm_icon { @@ -74,16 +74,16 @@ } .block_grade_me .empty img { - width: 15px; - height: 15px; float: left; + height: 15px; margin-right: 4px; + width: 15px; } .block_grade_me .excess { + color: rgb(205,0,0); + font-weight: bold; margin-top: 4px; padding: 4px 16px; text-align: center; - font-weight: bold; - color: rgb(205,0,0); } diff --git a/tests/grade_me_test.php b/tests/grade_me_test.php index 1950871..6a9d976 100644 --- a/tests/grade_me_test.php +++ b/tests/grade_me_test.php @@ -50,7 +50,7 @@ protected function create_grade_me_data($file) { $dataset = $this->createXMLDataSet(__DIR__.'/fixtures/'.$file); $names = array_flip($dataset->getTableNames()); - // Generate Data + // Generate Data. $generator = $this->getDataGenerator(); $users = array($generator->create_user(), $generator->create_user()); $courses = array($generator->create_course()); @@ -63,20 +63,19 @@ protected function create_grade_me_data($file) { $pgen = $generator->get_plugin_generator("mod_{$gradeable}"); $table = $dataset->getTable($gradeable); $rows = $table->getRowCount(); - $items = array(); for ($row = 0; $row < $rows; $row += 1) { $fields = $table->getRow($row); unset($fields['id']); $fields['course'] = $courses[$fields['course']]->id; $instance = $pgen->create_instance($fields); $context = context_module::instance($instance->cmid); - $plugins[] = (object) array('id' => $instance->id, 'cmid' => $instance->cmid, 'contextid' => $context->id); + $plugins[] = (object)array('id' => $instance->id, 'cmid' => $instance->cmid, 'contextid' => $context->id); } } $excludes[] = $gradeable; } - // Known overrides (compact form) + // Known overrides (compact form). $overrides = array( 'assignment' => array( 'values' => 'plugins', @@ -146,7 +145,7 @@ protected function create_grade_me_data($file) { $tables = array(); foreach ($overrides as $field => $override) { foreach ($override['tables'] as $tablename) { - // Skip tables that aren't in the dataset + // Skip tables that aren't in the dataset. if (array_key_exists($tablename, $names)) { if (!array_key_exists($tablename, $tables)) { $tables[$tablename] = array($field => array()); @@ -156,7 +155,7 @@ protected function create_grade_me_data($file) { } } - // Perform the overrides + // Perform the overrides. foreach ($tables as $tablename => $translations) { $table = $dataset->getTable($tablename); $rows = $table->getRowCount(); @@ -172,12 +171,12 @@ protected function create_grade_me_data($file) { } } - // Load the data + // Load the data. $filtered = new PHPUnit_Extensions_Database_DataSet_DataSetFilter($dataset); $filtered->addExcludeTables($excludes); $this->loadDataSet($filtered); - // Return the generated users and courses because the tests often need them for result calculations + // Return the generated users and courses because the tests often need them for result calculations. return array($users, $courses, $plugins); } @@ -197,7 +196,7 @@ protected function create_grade_me_data($file) { public function provider_get_content_multiple_user() { $data = array(); - // New assign test + // New assign test. $plugin = 'assign'; $matches = array( 1 => '/Go to assign/', @@ -209,7 +208,7 @@ public function provider_get_content_multiple_user() { ); $data['assign'] = array($plugin, $matches); - // Legacy assignment test + // Legacy assignment test. $plugin = 'assignment'; $matches = array( 1 => '/Go to assignment/', @@ -221,7 +220,7 @@ public function provider_get_content_multiple_user() { ); $data['assignment'] = array($plugin, $matches); - // Quiz test + // Quiz test. $plugin = 'quiz'; $matches = array( 1 => '/Go to quiz/', @@ -247,7 +246,7 @@ public function provider_get_content_multiple_user() { public function provider_get_content_single_user() { $data = array(); - // New assign test + // New assign test. $plugin = 'assign'; $matches = array( 1 => '/Go to assign/', @@ -258,7 +257,7 @@ public function provider_get_content_single_user() { ); $data['assign'] = array($plugin, $matches); - // Legacy assignment test + // Legacy assignment test. $plugin = 'assignment'; $matches = array( 1 => '/Go to assignment/', @@ -479,7 +478,7 @@ public function test_query_assign() { $rec2->userid = $users[0]->id; $rec2->timesubmitted = '3'; - // Tests resubmission + // Tests resubmission. $rec3 = new stdClass(); $rec3->id = $plugins[4]->id; $rec3->courseid = $courses[0]->id; @@ -497,7 +496,8 @@ public function test_query_assign() { * Test the block_grade_me_query_prefix function */ public function test_query_prefix() { - $expected = "SELECT bgm.courseid, bgm.coursename, bgm.itemmodule, bgm.iteminstance, bgm.itemname, bgm.coursemoduleid, bgm.itemsortorder"; + $expected = "SELECT bgm.courseid, bgm.coursename, bgm.itemmodule, bgm.iteminstance, bgm.itemname, " . + "bgm.coursemoduleid, bgm.itemsortorder"; $this->assertEquals($expected, block_grade_me_query_prefix()); } @@ -585,12 +585,12 @@ public function provider_cron() { * @depends test_load_db */ public function test_cron($expected) { - global $DB, $CFG; + global $DB; $this->resetAfterTest(true); $this->create_grade_me_data('block_grade_me.xml'); $user = $this->getDataGenerator()->create_user(); $this->setUser($user); - $course = $this->getDataGenerator()->create_course(); + $this->getDataGenerator()->create_course(); $grademe = new block_grade_me(); $grademe->cron(); @@ -615,7 +615,8 @@ public function test_query_quiz($datafile, $expected) { $this->update_quiz_ngrade(); list($sql, $params) = block_grade_me_query_quiz(array($users[0]->id)); - $sql = block_grade_me_query_prefix().$sql.block_grade_me_query_suffix('quiz'); + $sql = block_grade_me_query_prefix().$sql.block_grade_me_query_suffix('quiz') . + ' ORDER BY submissionid ASC'; $actual = array(); $result = $DB->get_recordset_sql($sql, array($params[0], $courses[0]->id)); @@ -623,7 +624,7 @@ public function test_query_quiz($datafile, $expected) { $actual[] = (array)$rec; } - // Set proper values for the results + // Set proper values for the results. foreach ($expected as $key => $row) { $row['coursemoduleid'] = $plugins[$row['coursemoduleid']]->cmid; $row['coursename'] = $courses[$row['courseid']]->fullname; @@ -661,14 +662,14 @@ public function test_query_glossary($datafile, $expected) { * Generic test that can be run by standard modules. */ public function standard_query_tests($datafile, $expected, $suffix) { - global $USER, $DB; + global $DB; $this->resetAfterTest(true); list($users, $courses, $plugins) = $this->create_grade_me_data($datafile); $dbfunction = 'block_grade_me_query_'.$suffix; list($sql, $params) = $dbfunction(array($users[0]->id)); - $sql = block_grade_me_query_prefix().$sql.block_grade_me_query_suffix($suffix). + $sql = block_grade_me_query_prefix().$sql.block_grade_me_query_suffix($suffix) . ' ORDER BY submissionid ASC'; $actual = array(); @@ -677,7 +678,7 @@ public function standard_query_tests($datafile, $expected, $suffix) { $actual[] = (array)$rec; } - // Set proper values for the results + // Set proper values for the results. foreach ($expected as $key => $row) { $row['coursemoduleid'] = $plugins[$row['coursemoduleid']]->cmid; $row['coursename'] = $courses[$row['courseid']]->fullname; @@ -749,12 +750,12 @@ public function test_query_assignment() { * @depends test_load_db */ public function test_get_content_single_user($plugin, $expectedvalues) { - global $CFG, $DB, $USER; + global $CFG, $DB; $this->resetAfterTest(true); list($users, $courses) = $this->create_grade_me_data('block_grade_me.xml'); - // Make sure that the plugin being tested has been enabled + // Make sure that the plugin being tested has been enabled. if (!$CFG->{'block_grade_me_enable'.$plugin} == true) { set_config('block_grade_me_enable'.$plugin, true); } @@ -765,9 +766,9 @@ public function test_get_content_single_user($plugin, $expectedvalues) { $this->setUser($users[0]); $this->setAdminUser($users[1]); - $course = $this->getDataGenerator()->create_course(); + $this->getDataGenerator()->create_course(); - // Set up gradebook role + // Set up gradebook role. $context = context_course::instance($courses[0]->id); $roleid = create_role('role', 'role', 'grade me block'); set_role_contextlevels($roleid, array(CONTEXT_COURSE)); @@ -808,7 +809,7 @@ public function test_get_content_single_user($plugin, $expectedvalues) { * @depends test_load_db */ public function test_get_content_multiple_user($plugin, $expectedvalues) { - global $CFG, $DB, $USER; + global $CFG, $DB; $this->resetAfterTest(true); if ($plugin !== 'quiz') { // Create data for assignements. @@ -820,7 +821,7 @@ public function test_get_content_multiple_user($plugin, $expectedvalues) { $this->update_quiz_ngrade(); } - // Make sure that the plugin being tested has been enabled + // Make sure that the plugin being tested has been enabled. if (!$CFG->{'block_grade_me_enable'.$plugin} == true) { set_config('block_grade_me_enable'.$plugin, true); } @@ -829,13 +830,13 @@ public function test_get_content_multiple_user($plugin, $expectedvalues) { set_config('block_grade_me_enableadminviewall', true); } - // When testing with multiple users - // Need multiple gradebookroles and timemodified needs to be different on submission + // When testing with multiple users, + // need multiple gradebookroles and timemodified needs to be different on submission. $this->setUser($users[0]); $adminuser = $this->getDataGenerator()->create_user(); $this->setAdminUser($adminuser); - // Set up gradebook roles + // Set up gradebook roles. $context = context_course::instance($courses[0]->id); $roleid = create_role('role', 'role', 'grade me block'); $roleid2 = create_role('role2', 'role2', 'grade me block');