Compare commits
105 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1a1d59ef61 | |||
| a2c785e795 | |||
| 9badb9eab5 | |||
| c142ad2370 | |||
| 6ebae3663e | |||
| 39c6bfbfdb | |||
| bcd17420a8 | |||
| 8fcbfe5218 | |||
| e1c1ff4be3 | |||
| 031220a009 | |||
| acb2ce417f | |||
| 89ec99bfa3 | |||
| a30aece8ad | |||
| 2d08bba8ab | |||
| 8c7fcbf590 | |||
| ea2f0af064 | |||
| 1eae36faf6 | |||
| fa60800431 | |||
| e564206e33 | |||
| c046a86fa5 | |||
| c02f5c7391 | |||
| aa335a7aba | |||
| 857507ce09 | |||
| f14576473d | |||
| 475702b9ef | |||
| 9be29c8ded | |||
| f574806a9a | |||
| 8622c37ecc | |||
| 0a4c70d7c2 | |||
| decc44fb26 | |||
| 151fd4caf9 | |||
| ca1da020ee | |||
| 4756608dbe | |||
| 8176483e0a | |||
| 4fe25d925f | |||
| f1a34c2ea0 | |||
| b611b74e33 | |||
| 6f6d548cfa | |||
| ed0f8f1de4 | |||
| 09b8347175 | |||
| ab65333718 | |||
| 71b5149443 | |||
| 4e98ec5ba5 | |||
| 083a7f5914 | |||
| 29a84a66db | |||
| 280eee89d4 | |||
| b0f1c1afe4 | |||
| ec07126d1b | |||
| 8cc1b41173 | |||
| 2023e58e7b | |||
| 031f5f372b | |||
| 0ae5ee6dfe | |||
| 7f2b1cba3d | |||
| 64ac84fdb5 | |||
| 1c2bdf454a | |||
| c22b94aea7 | |||
| ead9bafb54 | |||
| 8b4d9a91b5 | |||
| 37a1692b83 | |||
| c9d73621ce | |||
| 3f47f814a6 | |||
| ea288b3af7 | |||
| 853a350a7c | |||
| d03b556a1c | |||
| 179af9b420 | |||
| 79dfe05dfe | |||
| 2c2173b9b8 | |||
| 0761ab0be8 | |||
| 5cfdea895c | |||
| 13bda1114f | |||
| a59dec1555 | |||
| 4139a83154 | |||
| 4533cb81a4 | |||
| 3bfc3bfd28 | |||
| 437bab80d3 | |||
| cb57109bb4 | |||
| 156bf56f94 | |||
| c0388ff317 | |||
| 433bf40d3e | |||
| 8f3917ade6 | |||
| b4d8fb4aac | |||
| 5852121094 | |||
| 9fb9f4a2cc | |||
| e678f15d15 | |||
| a422cf3d29 | |||
| 96df425cdb | |||
| 05fb0e844c | |||
| ae675a315a | |||
| 23eb16a684 | |||
| 4079e743ac | |||
| 23589ac78d | |||
| 647c3293d3 | |||
| b9e8c673a8 | |||
| bbe934e819 | |||
| 54e0b7c8f2 | |||
| b8ecb227bb | |||
| 016ba38ab9 | |||
| 1a144ec3b1 | |||
| 8ea9583992 | |||
| d74575f458 | |||
| 6625857af9 | |||
| 70fbb57e42 | |||
| 8296126e99 | |||
| a60977e766 | |||
| 4c6b06ff3d |
@@ -7,6 +7,12 @@ on:
|
||||
- MOODLE_[0-9]+_STABLE
|
||||
tags-ignore:
|
||||
- v[0-9]+.[0-9]+.[0-9]+*
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
phpunit_extra_options:
|
||||
description: Additional options to apply to PHPUnit
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
env:
|
||||
php: 7.4
|
||||
@@ -109,4 +115,4 @@ jobs:
|
||||
- name: Running PHPUnit tests
|
||||
env:
|
||||
dbtype: ${{ matrix.db }}
|
||||
run: vendor/bin/phpunit -v
|
||||
run: vendor/bin/phpunit -v ${{ inputs.phpunit_extra_options }}
|
||||
|
||||
@@ -4301,6 +4301,199 @@
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mod_assignment" level="required">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_db_prefix_length" level="required">
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="4.4" requires="4.1.2">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mariadb" version="10.6.7" />
|
||||
<VENDOR name="mysql" version="8.0" />
|
||||
<VENDOR name="postgres" version="13" />
|
||||
<VENDOR name="mssql" version="14.0" />
|
||||
<VENDOR name="oracle" version="19" />
|
||||
</DATABASE>
|
||||
<PHP version="8.1.0" level="required">
|
||||
</PHP>
|
||||
<PCREUNICODE level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="pcreunicodewarning" />
|
||||
</FEEDBACK>
|
||||
</PCREUNICODE>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="iconvrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mbstringrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="curlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="openssl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="opensslrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="tokenizer" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="soap" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="soaprecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="ctype" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ctyperequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zip" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ziprequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zlib" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="gd" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="gdrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="simplexml" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="simplexmlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="spl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="splrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="pcre" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="dom" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xml" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlreader" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="intl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="intlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="json" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="hash" level="required"/>
|
||||
<PHP_EXTENSION name="fileinfo" level="required"/>
|
||||
<PHP_EXTENSION name="sodium" level="required"/>
|
||||
<PHP_EXTENSION name="exif" level="optional"/>
|
||||
</PHP_EXTENSIONS>
|
||||
<PHP_SETTINGS>
|
||||
<PHP_SETTING name="memory_limit" value="96M" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="settingmemorylimit" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="file_uploads" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingfileuploads" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="opcache.enable" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opcacherecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
</PHP_SETTINGS>
|
||||
<CUSTOM_CHECKS>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_storage_engine" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbstorageengine" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="quizattemptsupgradedmessage" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="slashargumentswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unsupporteddbtablerowformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_unoconv_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unoconvwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="libcurlwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_format" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbfileformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_per_table" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbfilepertable" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_large_prefix" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddblargeprefix" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_is_https" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="ishttpswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_incomplete_unicode_support" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="incompleteunicodesupport" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_sixtyfour_bits" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="sixtyfourbitsrequired" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_max_input_vars" level="optional">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_admin_dir_usage" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="iscustomadminwarnings" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_xmlrpc_usage" level="optional">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mod_assignment" level="required">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_db_prefix_length" level="required">
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
@@ -105,8 +105,7 @@ Feature: Set up contextual data for tests
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I am on the "Course 1" course page logged in as student1
|
||||
Then I should see "Topic 1"
|
||||
|
||||
Scenario: Add role assigns
|
||||
@@ -140,17 +139,11 @@ Feature: Set up contextual data for tests
|
||||
When I log in as "user1"
|
||||
And I am on site homepage
|
||||
Then "Edit settings" "link" should exist in current page administration
|
||||
And I log out
|
||||
And I log in as "user2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as user2
|
||||
And "Turn editing on" "button" should exist
|
||||
And I log out
|
||||
And I log in as "user3"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as user3
|
||||
And "Turn editing on" "button" should exist
|
||||
And I log out
|
||||
And I log in as "user4"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as user4
|
||||
And "Turn editing on" "button" should exist
|
||||
And I log out
|
||||
And I log in as "user5"
|
||||
@@ -192,8 +185,7 @@ Feature: Set up contextual data for tests
|
||||
And the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber | grade |
|
||||
| assign | Test assignment name with scale | Test assignment description | C1 | assign1 | Test Scale 1 |
|
||||
When I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
When I am on the "Course 1" course page logged in as admin
|
||||
Then I should see "Test assignment name"
|
||||
# Assignment 2.2 module type is disabled by default
|
||||
# And I should see "Test assignment22 name"
|
||||
@@ -311,9 +303,7 @@ Feature: Set up contextual data for tests
|
||||
And the following "grade categories" exist:
|
||||
| fullname | course | gradecategory |
|
||||
| Grade sub category 2 | C1 | Grade category 1 |
|
||||
When I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
When I am on the "Course 1" "grades > Grader report > View" page logged in as "admin"
|
||||
Then I should see "Grade category 1"
|
||||
And I should see "Grade sub category 2"
|
||||
|
||||
@@ -334,9 +324,7 @@ Feature: Set up contextual data for tests
|
||||
| itemname | course | gradecategory |
|
||||
| Test Grade Item 2 | C1 | Grade category 1 |
|
||||
| Test Grade Item 3 | C1 | Grade sub category 2 |
|
||||
When I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
When I am on the "Course 1" "grades > gradebook setup" page logged in as "admin"
|
||||
Then I should see "Test Grade Item 1"
|
||||
And I follow "Edit Test Grade Item 1"
|
||||
And I expand all fieldsets
|
||||
@@ -362,9 +350,7 @@ Feature: Set up contextual data for tests
|
||||
And the following "scales" exist:
|
||||
| name | scale |
|
||||
| Test Scale 1 | Disappointing, Good, Very good, Excellent |
|
||||
When I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Scales" in the course gradebook
|
||||
When I am on the "Course 1" "grades > scales" page logged in as admin
|
||||
Then I should see "Test Scale 1"
|
||||
And I should see "Disappointing, Good, Very good, Excellent"
|
||||
|
||||
@@ -383,9 +369,7 @@ Feature: Set up contextual data for tests
|
||||
| Grade outcome 2 | OT2 | C1 | Test Scale 1 |
|
||||
And the following config values are set as admin:
|
||||
| enableoutcomes | 1 |
|
||||
When I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Outcomes"
|
||||
When I am on the "Course 1" "grades > outcomes" page logged in as admin
|
||||
Then I should see "Grade outcome 1" in the "#addoutcomes" "css_element"
|
||||
And I should see "Grade outcome 2" in the "#removeoutcomes" "css_element"
|
||||
And I follow "Edit outcomes"
|
||||
|
||||
@@ -75,7 +75,7 @@ trait reader {
|
||||
*/
|
||||
public static function decode_other(?string $other) {
|
||||
if ($other === 'N;' || preg_match('~^.:~', $other)) {
|
||||
return unserialize($other);
|
||||
return unserialize($other, ['allowed_classes' => [stdClass::class]]);
|
||||
} else {
|
||||
return json_decode($other, true);
|
||||
}
|
||||
|
||||
@@ -59,9 +59,6 @@ Feature: Backup user data
|
||||
And I navigate to "Recycle bin" in current page administration
|
||||
And I should see "Quiz 1"
|
||||
And I click on "Restore" "link" in the "region-main" "region"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I navigate to "User report" in the course gradebook
|
||||
When I am on the "Course 1" "grades > User report > View" page logged in as "student1"
|
||||
Then "Quiz 1" row "Grade" column of "user-grade" table should contain "5"
|
||||
And "Quiz 1" row "Percentage" column of "user-grade" table should contain "50"
|
||||
|
||||
@@ -37,3 +37,13 @@ function tool_task_status_checks() : array {
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to handle mtrace by outputting the text to normal browser window.
|
||||
*
|
||||
* @param string $message Message to output
|
||||
* @param string $eol End of line character
|
||||
*/
|
||||
function tool_task_mtrace_wrapper(string $message, string $eol): void {
|
||||
$message = s($message);
|
||||
echo $message . $eol;
|
||||
}
|
||||
|
||||
@@ -30,16 +30,6 @@ require('../../../config.php');
|
||||
|
||||
require_once($CFG->libdir.'/cronlib.php');
|
||||
|
||||
/**
|
||||
* Function used to handle mtrace by outputting the text to normal browser window.
|
||||
*
|
||||
* @param string $message Message to output
|
||||
* @param string $eol End of line character
|
||||
*/
|
||||
function tool_task_mtrace_wrapper($message, $eol) {
|
||||
echo s($message . $eol);
|
||||
}
|
||||
|
||||
// Allow execution of single task. This requires login and has different rules.
|
||||
$taskname = required_param('task', PARAM_RAW_TRIMMED);
|
||||
|
||||
@@ -85,6 +75,7 @@ require_sesskey();
|
||||
|
||||
// Prepare to handle output via mtrace.
|
||||
echo html_writer::start_tag('pre');
|
||||
require('lib.php');
|
||||
$CFG->mtrace_wrapper = 'tool_task_mtrace_wrapper';
|
||||
|
||||
// Run the specified task (this will output an error if it doesn't exist).
|
||||
|
||||
@@ -173,13 +173,16 @@ class tool_uploadcourse_tracker {
|
||||
} else {
|
||||
$outcome = $OUTPUT->pix_icon('i/invalid', '');
|
||||
}
|
||||
|
||||
echo html_writer::start_tag('tr', array('class' => 'r' . $this->rownb % 2));
|
||||
echo html_writer::tag('td', $line, array('class' => 'c' . $ci++));
|
||||
echo html_writer::tag('td', $outcome, array('class' => 'c' . $ci++));
|
||||
echo html_writer::tag('td', isset($data['id']) ? $data['id'] : '', array('class' => 'c' . $ci++));
|
||||
echo html_writer::tag('td', isset($data['shortname']) ? $data['shortname'] : '', array('class' => 'c' . $ci++));
|
||||
echo html_writer::tag('td', isset($data['fullname']) ? $data['fullname'] : '', array('class' => 'c' . $ci++));
|
||||
echo html_writer::tag('td', isset($data['idnumber']) ? $data['idnumber'] : '', array('class' => 'c' . $ci++));
|
||||
|
||||
// Ensure our data is suitable for HTML output.
|
||||
echo html_writer::tag('td', isset($data['shortname']) ? s($data['shortname']) : '', array('class' => 'c' . $ci++));
|
||||
echo html_writer::tag('td', isset($data['fullname']) ? s($data['fullname']) : '', array('class' => 'c' . $ci++));
|
||||
echo html_writer::tag('td', isset($data['idnumber']) ? s($data['idnumber']) : '', array('class' => 'c' . $ci++));
|
||||
echo html_writer::tag('td', $status, array('class' => 'c' . $ci++));
|
||||
echo html_writer::end_tag('tr');
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ if (!\auth_oauth2\api::is_enabled()) {
|
||||
|
||||
$confirmed = $auth->user_confirm($username, $usersecret);
|
||||
|
||||
if ($confirmed == AUTH_CONFIRM_ALREADY) {
|
||||
if ($confirmed == AUTH_CONFIRM_ALREADY && !isloggedin()) {
|
||||
$user = get_complete_user_data('username', $username);
|
||||
$PAGE->navbar->add(get_string("alreadyconfirmed"));
|
||||
$PAGE->set_title(get_string("alreadyconfirmed"));
|
||||
@@ -61,11 +61,7 @@ if ($confirmed == AUTH_CONFIRM_ALREADY) {
|
||||
print_error('cannotfinduser', '', '', s($username));
|
||||
}
|
||||
|
||||
if (!$user->suspended) {
|
||||
complete_user_login($user);
|
||||
|
||||
\core\session\manager::apply_concurrent_login_limit($user->id, session_id());
|
||||
|
||||
if ($user->id == $USER->id) {
|
||||
// Check where to go, $redirect has a higher preference.
|
||||
if (empty($redirect) and !empty($SESSION->wantsurl) ) {
|
||||
$redirect = $SESSION->wantsurl;
|
||||
@@ -82,14 +78,20 @@ if ($confirmed == AUTH_CONFIRM_ALREADY) {
|
||||
$PAGE->set_heading($COURSE->fullname);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->box_start('generalbox centerpara boxwidthnormal boxaligncenter');
|
||||
echo "<h3>".get_string("thanks").", ". fullname($USER) . "</h3>\n";
|
||||
echo "<h3>".get_string("thanks").", ". fullname($user) . "</h3>\n";
|
||||
echo "<p>".get_string("confirmed")."</p>\n";
|
||||
echo $OUTPUT->single_button("$CFG->wwwroot/course/", get_string('courses'));
|
||||
if (!isloggedin() || isguestuser()) {
|
||||
echo $OUTPUT->single_button(get_login_url(), get_string('login'));
|
||||
} else {
|
||||
echo $OUTPUT->single_button("$CFG->wwwroot/login/logout.php", get_string('logout'));
|
||||
}
|
||||
echo $OUTPUT->box_end();
|
||||
echo $OUTPUT->footer();
|
||||
exit;
|
||||
} else {
|
||||
\core\notification::error(get_string('confirmationinvalid', 'auth_oauth2'));
|
||||
if (!isloggedin()) {
|
||||
\core\notification::error(get_string('confirmationinvalid', 'auth_oauth2'));
|
||||
}
|
||||
}
|
||||
|
||||
redirect("$CFG->wwwroot/");
|
||||
|
||||
@@ -1518,7 +1518,13 @@ class backup_block_instance_structure_step extends backup_structure_step {
|
||||
// Transform configdata information if needed (process links and friends)
|
||||
$blockrec = $DB->get_record('block_instances', array('id' => $this->task->get_blockid()));
|
||||
if ($attrstotransform = $this->task->get_configdata_encoded_attributes()) {
|
||||
$configdata = (array)unserialize(base64_decode($blockrec->configdata));
|
||||
$configdata = array_filter(
|
||||
(array) unserialize_object(base64_decode($blockrec->configdata)),
|
||||
static function($value): bool {
|
||||
return !($value instanceof __PHP_Incomplete_Class);
|
||||
}
|
||||
);
|
||||
|
||||
foreach ($configdata as $attribute => $value) {
|
||||
if (in_array($attribute, $attrstotransform)) {
|
||||
$configdata[$attribute] = $this->contenttransformer->process($value);
|
||||
|
||||
@@ -4196,7 +4196,13 @@ class restore_block_instance_structure_step extends restore_structure_step {
|
||||
// Let's look for anything within configdata neededing processing
|
||||
// (nulls and uses of legacy file.php)
|
||||
if ($attrstotransform = $this->task->get_configdata_encoded_attributes()) {
|
||||
$configdata = (array) unserialize_object(base64_decode($data->configdata));
|
||||
$configdata = array_filter(
|
||||
(array) unserialize_object(base64_decode($data->configdata)),
|
||||
static function($value): bool {
|
||||
return !($value instanceof __PHP_Incomplete_Class);
|
||||
}
|
||||
);
|
||||
|
||||
foreach ($configdata as $attribute => $value) {
|
||||
if (in_array($attribute, $attrstotransform)) {
|
||||
$configdata[$attribute] = $this->contentprocessor->process_cdata($value);
|
||||
|
||||
@@ -54,6 +54,8 @@ $badge = new badge($badgeid);
|
||||
$context = $badge->get_context();
|
||||
$navurl = new moodle_url('/badges/index.php', array('type' => $badge->type));
|
||||
|
||||
require_capability('moodle/badges:viewawarded', $context);
|
||||
|
||||
if ($badge->type == BADGE_TYPE_COURSE) {
|
||||
if (empty($CFG->badges_allowcoursebadges)) {
|
||||
print_error('coursebadgesdisabled', 'badges');
|
||||
|
||||
@@ -224,12 +224,19 @@ Feature: Award badges
|
||||
|
||||
@javascript
|
||||
Scenario: Award badge on course completion
|
||||
Given I log in as "teacher1"
|
||||
Given the following "activity" exists:
|
||||
| activity | chat |
|
||||
| course | C1 |
|
||||
| name | Music history |
|
||||
| section | 1 |
|
||||
| completion | 2 |
|
||||
| completionview | 1 |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Course completion" in current page administration
|
||||
And I set the field "id_overall_aggregation" to "2"
|
||||
And I click on "Condition: Activity completion" "link"
|
||||
And I set the field "Assignment - Test assignment name" to "1"
|
||||
And I set the field "Chat - Music history" to "1"
|
||||
And I press "Save changes"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Badges > Add a new badge" in current page administration
|
||||
@@ -249,8 +256,7 @@ Feature: Award badges
|
||||
And I follow "Profile" in the user menu
|
||||
And I click on "Course 1" "link" in the "region-main" "region"
|
||||
Then I should not see "badges"
|
||||
And I am on "Course 1" course homepage
|
||||
And I click on "Not completed: Test assignment name" "icon"
|
||||
When I am on the "Music history" "chat activity" page
|
||||
And I log out
|
||||
# Completion cron won't mark the whole course completed unless the
|
||||
# individual criteria was marked completed more than a second ago. So
|
||||
@@ -261,6 +267,7 @@ Feature: Award badges
|
||||
# The student should now see their badge.
|
||||
And I log in as "student1"
|
||||
And I follow "Profile" in the user menu
|
||||
And I click on "Course 1" "link" in the "region-main" "region"
|
||||
Then I should see "Course Badge"
|
||||
|
||||
@javascript
|
||||
|
||||
@@ -24,40 +24,23 @@ Feature: The activity results block displays student scores
|
||||
| student3 | C1 | student |
|
||||
| student4 | C1 | student |
|
||||
| student5 | C1 | student |
|
||||
And the following "activities" exist:
|
||||
| activity | name | intro | course | section | idnumber | assignsubmission_file_enabled |
|
||||
| assign | Test assignment 1 | Offline text | C1 | 1 | assign1 | 0 |
|
||||
| assign | Test assignment 2 | Offline text | C1 | 1 | assign2 | 0 |
|
||||
| assign | Test assignment 3 | Offline text | C1 | 1 | assign3 | 0 |
|
||||
And the following "activities" exist:
|
||||
| activity | name | content | course | section | idnumber |
|
||||
| page | Test page name | This is a page | C1 | 1 | page1 |
|
||||
And the following "grade grades" exist:
|
||||
| gradeitem | user | grade |
|
||||
| Test assignment 1 | student1 | 90.00 |
|
||||
| Test assignment 1 | student2 | 80.00 |
|
||||
| Test assignment 1 | student3 | 70.00 |
|
||||
| Test assignment 1 | student4 | 60.00 |
|
||||
| Test assignment 1 | student5 | 50.00 |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Assignment" to section "1" and I fill the form with:
|
||||
| Assignment name | Test assignment 1 |
|
||||
| Description | Offline text |
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
And I am on "Course 1" course homepage
|
||||
And I add a "Assignment" to section "1" and I fill the form with:
|
||||
| Assignment name | Test assignment 2 |
|
||||
| Description | Offline text |
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
And I am on "Course 1" course homepage
|
||||
And I add a "Assignment" to section "1" and I fill the form with:
|
||||
| Assignment name | Test assignment 3 |
|
||||
| Description | Offline text |
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
And I am on "Course 1" course homepage
|
||||
And I add a "Page" to section "1"
|
||||
And I set the following fields to these values:
|
||||
| Name | Test page name |
|
||||
| Description | Test page description |
|
||||
| Page content | This is a page |
|
||||
And I press "Save and return to course"
|
||||
And I am on "Course 1" course homepage
|
||||
And I should see "Test page name"
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I turn editing mode on
|
||||
And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment 1"
|
||||
And I give the grade "80.00" to the user "Student 2" for the grade item "Test assignment 1"
|
||||
And I give the grade "70.00" to the user "Student 3" for the grade item "Test assignment 1"
|
||||
And I give the grade "60.00" to the user "Student 4" for the grade item "Test assignment 1"
|
||||
And I give the grade "50.00" to the user "Student 5" for the grade item "Test assignment 1"
|
||||
And I press "Save changes"
|
||||
And I am on "Course 1" course homepage
|
||||
|
||||
Scenario: Configure the block on a non-graded activity to show 3 high scores
|
||||
Given I follow "Test page name"
|
||||
|
||||
@@ -24,22 +24,18 @@ Feature: The activity results block displays student high scores
|
||||
| student3 | C1 | student |
|
||||
| student4 | C1 | student |
|
||||
| student5 | C1 | student |
|
||||
And the following "activities" exist:
|
||||
| activity | name | intro | course | section | idnumber | assignsubmission_file_enabled |
|
||||
| assign | Test assignment | Offline text | C1 | 1 | assign1 | 0 |
|
||||
And the following "grade grades" exist:
|
||||
| gradeitem | user | grade |
|
||||
| Test assignment | student1 | 90.00 |
|
||||
| Test assignment | student2 | 80.00 |
|
||||
| Test assignment | student3 | 70.00 |
|
||||
| Test assignment | student4 | 60.00 |
|
||||
| Test assignment | student5 | 50.00 |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Assignment" to section "1" and I fill the form with:
|
||||
| Assignment name | Test assignment |
|
||||
| Description | Offline text |
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I turn editing mode on
|
||||
And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment"
|
||||
And I give the grade "80.00" to the user "Student 2" for the grade item "Test assignment"
|
||||
And I give the grade "70.00" to the user "Student 3" for the grade item "Test assignment"
|
||||
And I give the grade "60.00" to the user "Student 4" for the grade item "Test assignment"
|
||||
And I give the grade "50.00" to the user "Student 5" for the grade item "Test assignment"
|
||||
And I press "Save changes"
|
||||
And I am on "Course 1" course homepage
|
||||
|
||||
Scenario: Configure the block on the course page to show 0 high scores
|
||||
Given I add the "Activity results" block
|
||||
|
||||
@@ -24,14 +24,10 @@ Feature: The activity results block displays students high scores in group as sc
|
||||
| student3 | C1 | student |
|
||||
| student4 | C1 | student |
|
||||
| student5 | C1 | student |
|
||||
And the following "scales" exist:
|
||||
| name | scale |
|
||||
| My Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Scales" in the course gradebook
|
||||
And I press "Add a new scale"
|
||||
And I set the following fields to these values:
|
||||
| Name | My Scale |
|
||||
| Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
|
||||
And I press "Save changes"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Assignment" to section "1" and I fill the form with:
|
||||
| Assignment name | Test assignment |
|
||||
@@ -39,8 +35,7 @@ Feature: The activity results block displays students high scores in group as sc
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
| id_grade_modgrade_type | Scale |
|
||||
| id_grade_modgrade_scale | My Scale |
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I am on the "Course 1" "grades > Grader report > View" page
|
||||
And I turn editing mode on
|
||||
And I give the grade "Excellent!" to the user "Student 1" for the grade item "Test assignment"
|
||||
And I give the grade "Very good" to the user "Student 2" for the grade item "Test assignment"
|
||||
|
||||
@@ -41,14 +41,10 @@ Feature: The activity results block displays student in group high scores as sca
|
||||
| student4 | G2 |
|
||||
| student5 | G3 |
|
||||
| student6 | G3 |
|
||||
And the following "scales" exist:
|
||||
| name | scale |
|
||||
| My Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Scales" in the course gradebook
|
||||
And I press "Add a new scale"
|
||||
And I set the following fields to these values:
|
||||
| Name | My Scale |
|
||||
| Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
|
||||
And I press "Save changes"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Assignment" to section "1" and I fill the form with:
|
||||
| Assignment name | Test assignment |
|
||||
@@ -57,8 +53,7 @@ Feature: The activity results block displays student in group high scores as sca
|
||||
| id_grade_modgrade_type | Scale |
|
||||
| id_grade_modgrade_scale | My Scale |
|
||||
| Group mode | Separate groups |
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I am on the "Course 1" "grades > Grader report > View" page
|
||||
And I turn editing mode on
|
||||
And I give the grade "Excellent!" to the user "Student 1" for the grade item "Test assignment"
|
||||
And I give the grade "Very good" to the user "Student 2" for the grade item "Test assignment"
|
||||
@@ -80,9 +75,7 @@ Feature: The activity results block displays student in group high scores as sca
|
||||
And I press "Save changes"
|
||||
Then I should see "Group 1" in the "Activity results" "block"
|
||||
And I should see "Excellent!" in the "Activity results" "block"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
Then I am on the "Course 1" course page logged in as student1
|
||||
And I should see "Student 1" in the "Activity results" "block"
|
||||
And I should see "Excellent!" in the "Activity results" "block"
|
||||
|
||||
@@ -101,9 +94,7 @@ Feature: The activity results block displays student in group high scores as sca
|
||||
And I should see "Very good" in the "Activity results" "block"
|
||||
And I should see "Group 3" in the "Activity results" "block"
|
||||
And I should see "Good" in the "Activity results" "block"
|
||||
And I log out
|
||||
And I log in as "student3"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student3
|
||||
And I should see "Student 3" in the "Activity results" "block"
|
||||
And I should see "Very good" in the "Activity results" "block"
|
||||
And I should see "Student 4" in the "Activity results" "block"
|
||||
@@ -124,10 +115,8 @@ Feature: The activity results block displays student in group high scores as sca
|
||||
And I should see "Excellent!" in the "Activity results" "block"
|
||||
And I should see "Very good" in the "Activity results" "block"
|
||||
And I should see "Good" in the "Activity results" "block"
|
||||
And I log out
|
||||
# Students cannot see user identity fields.
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student1
|
||||
And I should see "User" in the "Activity results" "block"
|
||||
And I should not see "User S1" in the "Activity results" "block"
|
||||
And I should see "Excellent!" in the "Activity results" "block"
|
||||
@@ -147,9 +136,7 @@ Feature: The activity results block displays student in group high scores as sca
|
||||
And I should see "Excellent!" in the "Activity results" "block"
|
||||
And I should see "Very good" in the "Activity results" "block"
|
||||
And I should see "Good" in the "Activity results" "block"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student1
|
||||
And I should see "User" in the "Activity results" "block"
|
||||
And I should see "Excellent!" in the "Activity results" "block"
|
||||
And I should see "Very good" in the "Activity results" "block"
|
||||
|
||||
@@ -41,24 +41,24 @@ Feature: The activity results block displays student in separate groups scores
|
||||
| student4 | G2 |
|
||||
| student5 | G3 |
|
||||
| student6 | G3 |
|
||||
And the following "activity" exists:
|
||||
| activity | assign |
|
||||
| course | C1 |
|
||||
| idnumber | 0001 |
|
||||
| name | Test assignment |
|
||||
| section | 1 |
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
| groupmode | 1 |
|
||||
And the following "grade grades" exist:
|
||||
| gradeitem | user | grade |
|
||||
| Test assignment | student1 | 100.00 |
|
||||
| Test assignment | student2 | 90.00 |
|
||||
| Test assignment | student3 | 90.00 |
|
||||
| Test assignment | student4 | 80.00 |
|
||||
| Test assignment | student5 | 80.00 |
|
||||
| Test assignment | student6 | 70.00 |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Assignment" to section "1" and I fill the form with:
|
||||
| Assignment name | Test assignment |
|
||||
| Description | Offline text |
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
| Group mode | Separate groups |
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I turn editing mode on
|
||||
And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment"
|
||||
And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment"
|
||||
And I give the grade "90.00" to the user "Student 3" for the grade item "Test assignment"
|
||||
And I give the grade "80.00" to the user "Student 4" for the grade item "Test assignment"
|
||||
And I give the grade "80.00" to the user "Student 5" for the grade item "Test assignment"
|
||||
And I give the grade "70.00" to the user "Student 6" for the grade item "Test assignment"
|
||||
And I press "Save changes"
|
||||
And I am on "Course 1" course homepage
|
||||
|
||||
Scenario: Configure the block on the course page to show 1 high score
|
||||
Given I add the "Activity results" block
|
||||
@@ -86,9 +86,7 @@ Feature: The activity results block displays student in separate groups scores
|
||||
And I press "Save changes"
|
||||
Then I should see "Group 1" in the "Activity results" "block"
|
||||
And I should see "95.00/100.00" in the "Activity results" "block"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student1
|
||||
And I should see "Student 1" in the "Activity results" "block"
|
||||
And I should see "100.00/100.00" in the "Activity results" "block"
|
||||
|
||||
@@ -104,9 +102,7 @@ Feature: The activity results block displays student in separate groups scores
|
||||
And I press "Save changes"
|
||||
Then I should see "Group 1" in the "Activity results" "block"
|
||||
And I should see "95.00" in the "Activity results" "block"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student1
|
||||
And I should see "Student 1" in the "Activity results" "block"
|
||||
And I should see "100.00" in the "Activity results" "block"
|
||||
|
||||
@@ -127,9 +123,7 @@ Feature: The activity results block displays student in separate groups scores
|
||||
And I should see "85%" in the "Activity results" "block"
|
||||
And I should see "Group 3" in the "Activity results" "block"
|
||||
And I should see "75%" in the "Activity results" "block"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student1
|
||||
And I should see "Student 1" in the "Activity results" "block"
|
||||
And I should see "100%" in the "Activity results" "block"
|
||||
And I should see "Student 2" in the "Activity results" "block"
|
||||
@@ -151,9 +145,7 @@ Feature: The activity results block displays student in separate groups scores
|
||||
And I should see "85.00/100.00" in the "Activity results" "block"
|
||||
And I should see "Group 3" in the "Activity results" "block"
|
||||
And I should see "75.00/100.00" in the "Activity results" "block"
|
||||
And I log out
|
||||
And I log in as "student3"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student3
|
||||
And I should see "Student 3" in the "Activity results" "block"
|
||||
And I should see "90.00/100.00" in the "Activity results" "block"
|
||||
And I should see "Student 4" in the "Activity results" "block"
|
||||
@@ -175,9 +167,7 @@ Feature: The activity results block displays student in separate groups scores
|
||||
And I should see "85.00" in the "Activity results" "block"
|
||||
And I should see "Group 3" in the "Activity results" "block"
|
||||
And I should see "75.00" in the "Activity results" "block"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student1
|
||||
And I should see "Student 1" in the "Activity results" "block"
|
||||
And I should see "100.00" in the "Activity results" "block"
|
||||
And I should see "Student 2" in the "Activity results" "block"
|
||||
@@ -199,10 +189,8 @@ Feature: The activity results block displays student in separate groups scores
|
||||
And I should see "95.00%" in the "Activity results" "block"
|
||||
And I should see "85.00%" in the "Activity results" "block"
|
||||
And I should see "75.00%" in the "Activity results" "block"
|
||||
And I log out
|
||||
# Students cannot see user identity fields.
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student1
|
||||
And I should see "User" in the "Activity results" "block"
|
||||
And I should not see "User S1" in the "Activity results" "block"
|
||||
And I should see "100.00%" in the "Activity results" "block"
|
||||
@@ -223,9 +211,7 @@ Feature: The activity results block displays student in separate groups scores
|
||||
And I should see "95.00%" in the "Activity results" "block"
|
||||
And I should see "85.00%" in the "Activity results" "block"
|
||||
And I should see "75.00%" in the "Activity results" "block"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student1
|
||||
And I should see "User" in the "Activity results" "block"
|
||||
And I should see "100.00%" in the "Activity results" "block"
|
||||
And I should see "90.00%" in the "Activity results" "block"
|
||||
|
||||
@@ -48,8 +48,7 @@ Feature: The activity results block displays student in visible groups scores
|
||||
| Description | Offline text |
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
| Group mode | Visible groups |
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I am on the "Course 1" "grades > Grader report > View" page logged in as teacher1
|
||||
And I turn editing mode on
|
||||
And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment"
|
||||
And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment"
|
||||
@@ -58,7 +57,7 @@ Feature: The activity results block displays student in visible groups scores
|
||||
And I give the grade "80.00" to the user "Student 5" for the grade item "Test assignment"
|
||||
And I give the grade "70.00" to the user "Student 6" for the grade item "Test assignment"
|
||||
And I press "Save changes"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
|
||||
Scenario: Configure the block on the course page to show 1 high score
|
||||
Given I add the "Activity results" block
|
||||
|
||||
@@ -24,22 +24,21 @@ Feature: The activity results block displays student low scores
|
||||
| student3 | C1 | student |
|
||||
| student4 | C1 | student |
|
||||
| student5 | C1 | student |
|
||||
And the following "activity" exists:
|
||||
| activity | assign |
|
||||
| course | C1 |
|
||||
| idnumber | 0001 |
|
||||
| name | Test assignment |
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
And the following "grade grades" exist:
|
||||
| gradeitem | user | grade |
|
||||
| Test assignment | student1 | 90.00 |
|
||||
| Test assignment | student2 | 80.00 |
|
||||
| Test assignment | student3 | 70.00 |
|
||||
| Test assignment | student4 | 60.00 |
|
||||
| Test assignment | student5 | 50.00 |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Assignment" to section "1" and I fill the form with:
|
||||
| Assignment name | Test assignment |
|
||||
| Description | Offline text |
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I turn editing mode on
|
||||
And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment"
|
||||
And I give the grade "80.00" to the user "Student 2" for the grade item "Test assignment"
|
||||
And I give the grade "70.00" to the user "Student 3" for the grade item "Test assignment"
|
||||
And I give the grade "60.00" to the user "Student 4" for the grade item "Test assignment"
|
||||
And I give the grade "50.00" to the user "Student 5" for the grade item "Test assignment"
|
||||
And I press "Save changes"
|
||||
And I am on "Course 1" course homepage
|
||||
|
||||
Scenario: Configure the block on the course page to show 1 low score
|
||||
Given I add the "Activity results" block
|
||||
|
||||
@@ -24,14 +24,10 @@ Feature: The activity results block displays student low scores as scales
|
||||
| student3 | C1 | student |
|
||||
| student4 | C1 | student |
|
||||
| student5 | C1 | student |
|
||||
And the following "scales" exist:
|
||||
| name | scale |
|
||||
| My Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Scales" in the course gradebook
|
||||
And I press "Add a new scale"
|
||||
And I set the following fields to these values:
|
||||
| Name | My Scale |
|
||||
| Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
|
||||
And I press "Save changes"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Assignment" to section "1" and I fill the form with:
|
||||
| Assignment name | Test assignment |
|
||||
@@ -39,8 +35,7 @@ Feature: The activity results block displays student low scores as scales
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
| id_grade_modgrade_type | Scale |
|
||||
| id_grade_modgrade_scale | My Scale |
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I am on the "Course 1" "grades > Grader report > View" page
|
||||
And I turn editing mode on
|
||||
And I give the grade "Excellent!" to the user "Student 1" for the grade item "Test assignment"
|
||||
And I give the grade "Very good" to the user "Student 2" for the grade item "Test assignment"
|
||||
|
||||
@@ -41,24 +41,24 @@ Feature: The activity results block displays students in groups low scores as sc
|
||||
| student4 | G2 |
|
||||
| student5 | G3 |
|
||||
| student6 | G3 |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Scales" in the course gradebook
|
||||
And I press "Add a new scale"
|
||||
And the following "activity" exists:
|
||||
| activity | assign |
|
||||
| course | C1 |
|
||||
| idnumber | 0001 |
|
||||
| name | Test assignment |
|
||||
| description | Offline text |
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
| groupmode | 1 |
|
||||
And the following "scales" exist:
|
||||
| name | scale |
|
||||
| My Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
|
||||
And I change window size to "large"
|
||||
And I am on the "Test assignment" "assign activity editing" page logged in as teacher1
|
||||
And I set the following fields to these values:
|
||||
| Name | My Scale |
|
||||
| Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
|
||||
And I press "Save changes"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Assignment" to section "1" and I fill the form with:
|
||||
| Assignment name | Test assignment |
|
||||
| Description | Offline text |
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
| id_grade_modgrade_type | Scale |
|
||||
| id_grade_modgrade_scale | My Scale |
|
||||
| Group mode | Separate groups |
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I press "Save and return to course"
|
||||
And I am on the "Course 1" "grades > Grader report > View" page
|
||||
And I turn editing mode on
|
||||
And I give the grade "Excellent!" to the user "Student 1" for the grade item "Test assignment"
|
||||
And I give the grade "Very good" to the user "Student 2" for the grade item "Test assignment"
|
||||
@@ -67,7 +67,7 @@ Feature: The activity results block displays students in groups low scores as sc
|
||||
And I give the grade "Good" to the user "Student 5" for the grade item "Test assignment"
|
||||
And I give the grade "Average" to the user "Student 6" for the grade item "Test assignment"
|
||||
And I press "Save changes"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
|
||||
Scenario: Try to configure the block on the course page to show 1 low score
|
||||
Given I add the "Activity results" block
|
||||
@@ -80,9 +80,7 @@ Feature: The activity results block displays students in groups low scores as sc
|
||||
And I press "Save changes"
|
||||
Then I should see "Group 3" in the "Activity results" "block"
|
||||
And I should see "Good" in the "Activity results" "block"
|
||||
And I log out
|
||||
And I log in as "student5"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student5
|
||||
And I should see "Student 6" in the "Activity results" "block"
|
||||
And I should see "Average" in the "Activity results" "block"
|
||||
|
||||
@@ -99,9 +97,7 @@ Feature: The activity results block displays students in groups low scores as sc
|
||||
And I should see "Very good" in the "Activity results" "block"
|
||||
And I should see "Group 3" in the "Activity results" "block"
|
||||
And I should see "Good" in the "Activity results" "block"
|
||||
And I log out
|
||||
And I log in as "student3"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student3
|
||||
And I should see "Student 3" in the "Activity results" "block"
|
||||
And I should see "Very good" in the "Activity results" "block"
|
||||
And I should see "Student 4" in the "Activity results" "block"
|
||||
@@ -121,10 +117,8 @@ Feature: The activity results block displays students in groups low scores as sc
|
||||
Then I should see "Group" in the "Activity results" "block"
|
||||
And I should see "Very good" in the "Activity results" "block"
|
||||
And I should see "Good" in the "Activity results" "block"
|
||||
And I log out
|
||||
# Students cannot see user identity fields.
|
||||
And I log in as "student5"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student5
|
||||
And I should see "User" in the "Activity results" "block"
|
||||
And I should not see "User S5" in the "Activity results" "block"
|
||||
And I should see "Good" in the "Activity results" "block"
|
||||
@@ -143,9 +137,7 @@ Feature: The activity results block displays students in groups low scores as sc
|
||||
Then I should see "Group" in the "Activity results" "block"
|
||||
And I should see "Very good" in the "Activity results" "block"
|
||||
And I should see "Good" in the "Activity results" "block"
|
||||
And I log out
|
||||
And I log in as "student5"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student5
|
||||
And I should see "User" in the "Activity results" "block"
|
||||
And I should see "Good" in the "Activity results" "block"
|
||||
And I should see "Average" in the "Activity results" "block"
|
||||
|
||||
@@ -41,24 +41,19 @@ Feature: The activity results block displays students in separate groups scores
|
||||
| student4 | G2 |
|
||||
| student5 | G3 |
|
||||
| student6 | G3 |
|
||||
And the following "activities" exist:
|
||||
| activity | course | idnumber | name | assignsubmission_file_enabled | groupmode |
|
||||
| assign | C1 | a1 | Test assignment | 0 | 1 |
|
||||
And the following "grade grades" exist:
|
||||
| gradeitem | user | grade |
|
||||
| Test assignment | student1 | 100.00 |
|
||||
| Test assignment | student2 | 90.00 |
|
||||
| Test assignment | student3 | 90.00 |
|
||||
| Test assignment | student4 | 80.00 |
|
||||
| Test assignment | student5 | 80.00 |
|
||||
| Test assignment | student6 | 70.00 |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Assignment" to section "1" and I fill the form with:
|
||||
| Assignment name | Test assignment |
|
||||
| Description | Offline text |
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
| Group mode | Separate groups |
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I turn editing mode on
|
||||
And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment"
|
||||
And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment"
|
||||
And I give the grade "90.00" to the user "Student 3" for the grade item "Test assignment"
|
||||
And I give the grade "80.00" to the user "Student 4" for the grade item "Test assignment"
|
||||
And I give the grade "80.00" to the user "Student 5" for the grade item "Test assignment"
|
||||
And I give the grade "70.00" to the user "Student 6" for the grade item "Test assignment"
|
||||
And I press "Save changes"
|
||||
And I am on "Course 1" course homepage
|
||||
|
||||
Scenario: Configure the block on the course page to show 1 low score
|
||||
Given I add the "Activity results" block
|
||||
@@ -86,9 +81,7 @@ Feature: The activity results block displays students in separate groups scores
|
||||
And I press "Save changes"
|
||||
Then I should see "Group 3" in the "Activity results" "block"
|
||||
And I should see "75.00/100.00" in the "Activity results" "block"
|
||||
And I log out
|
||||
And I log in as "student5"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student5
|
||||
And I should see "Student 6" in the "Activity results" "block"
|
||||
And I should see "70.00/100.00" in the "Activity results" "block"
|
||||
|
||||
@@ -104,9 +97,7 @@ Feature: The activity results block displays students in separate groups scores
|
||||
And I press "Save changes"
|
||||
Then I should see "Group 3" in the "Activity results" "block"
|
||||
And I should see "75.00" in the "Activity results" "block"
|
||||
And I log out
|
||||
And I log in as "student5"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student5
|
||||
And I should see "Student 6" in the "Activity results" "block"
|
||||
And I should see "70.00" in the "Activity results" "block"
|
||||
|
||||
@@ -125,9 +116,7 @@ Feature: The activity results block displays students in separate groups scores
|
||||
And I should see "85%" in the "Activity results" "block"
|
||||
And I should see "Group 3" in the "Activity results" "block"
|
||||
And I should see "75%" in the "Activity results" "block"
|
||||
And I log out
|
||||
And I log in as "student5"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student5
|
||||
And I should see "Student 6" in the "Activity results" "block"
|
||||
And I should see "70%" in the "Activity results" "block"
|
||||
And I should see "Student 5" in the "Activity results" "block"
|
||||
@@ -147,9 +136,7 @@ Feature: The activity results block displays students in separate groups scores
|
||||
And I should see "85.00/100.00" in the "Activity results" "block"
|
||||
And I should see "Group 3" in the "Activity results" "block"
|
||||
And I should see "75.00/100.00" in the "Activity results" "block"
|
||||
And I log out
|
||||
And I log in as "student3"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student3
|
||||
And I should see "Student 3" in the "Activity results" "block"
|
||||
And I should see "90.00/100.00" in the "Activity results" "block"
|
||||
And I should see "Student 4" in the "Activity results" "block"
|
||||
@@ -169,9 +156,7 @@ Feature: The activity results block displays students in separate groups scores
|
||||
And I should see "85.00" in the "Activity results" "block"
|
||||
And I should see "Group 3" in the "Activity results" "block"
|
||||
And I should see "75.00" in the "Activity results" "block"
|
||||
And I log out
|
||||
And I log in as "student5"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student5
|
||||
And I should see "Student 5" in the "Activity results" "block"
|
||||
And I should see "80.00" in the "Activity results" "block"
|
||||
And I should see "Student 6" in the "Activity results" "block"
|
||||
@@ -192,10 +177,8 @@ Feature: The activity results block displays students in separate groups scores
|
||||
Then I should see "Group" in the "Activity results" "block"
|
||||
And I should see "85.00%" in the "Activity results" "block"
|
||||
And I should see "75.00%" in the "Activity results" "block"
|
||||
And I log out
|
||||
# Students cannot see user identity fields.
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student1
|
||||
And I should see "User" in the "Activity results" "block"
|
||||
And I should not see "User S1" in the "Activity results" "block"
|
||||
And I should see "100.00%" in the "Activity results" "block"
|
||||
@@ -215,9 +198,7 @@ Feature: The activity results block displays students in separate groups scores
|
||||
Then I should see "Group" in the "Activity results" "block"
|
||||
And I should see "85.00%" in the "Activity results" "block"
|
||||
And I should see "75.00%" in the "Activity results" "block"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student1
|
||||
And I should see "User" in the "Activity results" "block"
|
||||
And I should see "100.00%" in the "Activity results" "block"
|
||||
And I should see "90.00%" in the "Activity results" "block"
|
||||
|
||||
@@ -48,8 +48,7 @@ Feature: The activity results block displays student in visible groups low score
|
||||
| Description | Offline text |
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
| Group mode | Visible groups |
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I am on the "Course 1" "grades > grader report > View" page
|
||||
And I turn editing mode on
|
||||
And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment"
|
||||
And I give the grade "90.00" to the user "Student 2" for the grade item "Test assignment"
|
||||
@@ -84,9 +83,7 @@ Feature: The activity results block displays student in visible groups low score
|
||||
| id_config_nameformat | Display full names |
|
||||
| id_config_usegroups | Yes |
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
Then I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
Then I am on the "Course 1" course page logged in as student1
|
||||
And I should see "Group 3" in the "Activity results" "block"
|
||||
And I should see "75.00/100.00" in the "Activity results" "block"
|
||||
|
||||
@@ -100,9 +97,7 @@ Feature: The activity results block displays student in visible groups low score
|
||||
| id_config_nameformat | Display full names |
|
||||
| id_config_usegroups | Yes |
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
Then I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
Then I am on the "Course 1" course page logged in as student1
|
||||
And I should see "Group 3" in the "Activity results" "block"
|
||||
And I should see "75.00" in the "Activity results" "block"
|
||||
|
||||
@@ -121,9 +116,7 @@ Feature: The activity results block displays student in visible groups low score
|
||||
And I should see "85%" in the "Activity results" "block"
|
||||
And I should see "Group 3" in the "Activity results" "block"
|
||||
And I should see "75%" in the "Activity results" "block"
|
||||
And I log out
|
||||
And I log in as "student5"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student5
|
||||
Then I should see "Group 2" in the "Activity results" "block"
|
||||
And I should see "85%" in the "Activity results" "block"
|
||||
And I should see "Group 3" in the "Activity results" "block"
|
||||
@@ -139,9 +132,7 @@ Feature: The activity results block displays student in visible groups low score
|
||||
| id_config_nameformat | Display full names |
|
||||
| id_config_usegroups | Yes |
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
Then I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
Then I am on the "Course 1" course page logged in as student1
|
||||
And I should see "Group 2" in the "Activity results" "block"
|
||||
And I should see "85.00/100.00" in the "Activity results" "block"
|
||||
And I should see "Group 3" in the "Activity results" "block"
|
||||
@@ -157,9 +148,7 @@ Feature: The activity results block displays student in visible groups low score
|
||||
| id_config_nameformat | Display full names |
|
||||
| id_config_usegroups | Yes |
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
Then I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
Then I am on the "Course 1" course page logged in as student1
|
||||
And I should see "Group 2" in the "Activity results" "block"
|
||||
And I should see "85.00" in the "Activity results" "block"
|
||||
And I should see "Group 3" in the "Activity results" "block"
|
||||
@@ -177,9 +166,7 @@ Feature: The activity results block displays student in visible groups low score
|
||||
| id_config_nameformat | Display only ID numbers |
|
||||
| id_config_usegroups | Yes |
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
Then I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
Then I am on the "Course 1" course page logged in as student1
|
||||
And I should see "Group" in the "Activity results" "block"
|
||||
And I should see "85.00%" in the "Activity results" "block"
|
||||
And I should see "75.00%" in the "Activity results" "block"
|
||||
@@ -194,9 +181,7 @@ Feature: The activity results block displays student in visible groups low score
|
||||
| id_config_nameformat | Anonymous results |
|
||||
| id_config_usegroups | Yes |
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
Then I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
Then I am on the "Course 1" course page logged in as student1
|
||||
And I should see "Group" in the "Activity results" "block"
|
||||
And I should see "85.00%" in the "Activity results" "block"
|
||||
And I should see "75.00%" in the "Activity results" "block"
|
||||
|
||||
@@ -18,17 +18,12 @@ Feature: Latest announcements block displays the course latest news
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| news_items | Course | C1 | course-view-* | side-pre |
|
||||
And I am on the "Course 1" Course page logged in as teacher1
|
||||
When I add a new topic to "Announcements" forum with:
|
||||
| Subject | Discussion One |
|
||||
| Message | Not important |
|
||||
And I add a new topic to "Announcements" forum with:
|
||||
| Subject | Discussion Two |
|
||||
| Message | Not important |
|
||||
And I add a new topic to "Announcements" forum with:
|
||||
| Subject | Discussion Three |
|
||||
| Message | Not important |
|
||||
And I am on "Course 1" course homepage
|
||||
And the following "mod_forum > discussions" exist:
|
||||
| user | forum | name | message |
|
||||
| teacher1 | Announcements | Discussion One | Not important |
|
||||
| teacher1 | Announcements | Discussion Two | Not important |
|
||||
| teacher1 | Announcements | Discussion Three | Not important |
|
||||
When I am on the "Course 1" Course page logged in as teacher1
|
||||
Then I should see "Discussion One" in the "Latest announcements" "block"
|
||||
And I should see "Discussion Two" in the "Latest announcements" "block"
|
||||
And I should see "Discussion Three" in the "Latest announcements" "block"
|
||||
|
||||
@@ -23,6 +23,9 @@ Feature: The search forums block allows users to search for forum posts on cours
|
||||
And I am on the "Course 1" "course editing" page logged in as teacher1
|
||||
And I set the field "id_newsitems" to "1"
|
||||
And I press "Save and display"
|
||||
And the following "mod_forum > discussions" exist:
|
||||
| user | forum | name | message |
|
||||
| teacher1 | Announcements | My subject | My message |
|
||||
|
||||
Scenario: Use the search forum block in a course without any forum posts
|
||||
Given I am on the "Course 1" course page logged in as student1
|
||||
@@ -32,12 +35,7 @@ Feature: The search forums block allows users to search for forum posts on cours
|
||||
Then I should see "No posts"
|
||||
|
||||
Scenario: Use the search forum block in a course with a hidden forum and search for posts
|
||||
Given I add a new topic to "Announcements" forum with:
|
||||
| Subject | My subject |
|
||||
| Message | My message |
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I follow "Announcements"
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
Given I am on the "Announcements" "forum activity editing" page logged in as teacher1
|
||||
And I expand all fieldsets
|
||||
And I set the field "id_visible" to "0"
|
||||
And I press "Save and return to course"
|
||||
@@ -49,10 +47,7 @@ Feature: The search forums block allows users to search for forum posts on cours
|
||||
Then I should see "No posts"
|
||||
|
||||
Scenario: Use the search forum block in a course and search for posts
|
||||
Given I add a new topic to "Announcements" forum with:
|
||||
| Subject | My subject |
|
||||
| Message | My message |
|
||||
When I am on the "Course 1" course page logged in as student1
|
||||
Given I am on the "Course 1" course page logged in as student1
|
||||
And "Search forums" "block" should exist
|
||||
And I set the following fields to these values:
|
||||
| searchform_search | message |
|
||||
|
||||
@@ -2131,6 +2131,19 @@ class core_course_external extends external_api {
|
||||
self::validate_context($categorycontext);
|
||||
require_capability('moodle/category:manage', $categorycontext);
|
||||
|
||||
// If the category parent is being changed, check for capability in the new parent category
|
||||
if (isset($cat['parent']) && ($cat['parent'] !== $category->parent)) {
|
||||
if ($cat['parent'] == 0) {
|
||||
// Creating a top level category requires capability in the system context
|
||||
$parentcontext = context_system::instance();
|
||||
} else {
|
||||
// Category context
|
||||
$parentcontext = context_coursecat::instance($cat['parent']);
|
||||
}
|
||||
self::validate_context($parentcontext);
|
||||
require_capability('moodle/category:manage', $parentcontext);
|
||||
}
|
||||
|
||||
// this will throw an exception if descriptionformat is not valid
|
||||
external_validate_format($cat['descriptionformat']);
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
@core @core_course
|
||||
Feature: Delete activity and resource works correctly
|
||||
As a teacher
|
||||
I want to be able to delete an activity and resource
|
||||
So that I can remove it from the course
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And the following "activities" exist:
|
||||
| activity | course | name | intro |
|
||||
| label | C1 | Label 1 | Label 1 |
|
||||
| glossary | C1 | Glossary 1 | Glossary 1 |
|
||||
|
||||
@javascript
|
||||
Scenario: Activity and resource can be deleted properly
|
||||
Given I am on the "Course 1" course page logged in as teacher1
|
||||
And I turn editing mode on
|
||||
And I open "Label 1" actions menu
|
||||
When I click on "Delete" "link" in the "Label 1" activity
|
||||
And I click on "Yes" "button" in the "Confirm" "dialogue"
|
||||
# Confirm that label is successfully deleted
|
||||
Then I should not see "Label 1"
|
||||
And I open "Glossary 1" actions menu
|
||||
And I click on "Delete" "link" in the "Glossary 1" activity
|
||||
And I click on "Yes" "button" in the "Confirm" "dialogue"
|
||||
# Confirm that glossary is successfully deleted
|
||||
And I should not see "Glossary 1"
|
||||
# Reload the page and confirm that both the label and glossary are really deleted
|
||||
And I reload the page
|
||||
And I should not see "Label 1"
|
||||
And I should not see "Glossary 1"
|
||||
@@ -0,0 +1,71 @@
|
||||
@core @core_course
|
||||
Feature: Display activity and resource description
|
||||
In order to display activity and resource description
|
||||
As teacher
|
||||
I should be able to enable "Display description on course page"
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
|
||||
Scenario Outline: Display activity and resource descriptions
|
||||
# Generate activity/resource with description
|
||||
Given the following "activities" exist:
|
||||
| activity | course | name | intro | showdescription |
|
||||
| <acttype> | C1 | <actname> | <actname> intro | 1 |
|
||||
When I am on the "Course 1" course page logged in as teacher1
|
||||
# Confirm that activity name and description are displayed
|
||||
Then I should see "<actname>" in the "region-main" "region"
|
||||
And I should see "<actname> intro" in the "region-main" "region"
|
||||
|
||||
Examples:
|
||||
| acttype | actname |
|
||||
| assign | Assign 1 |
|
||||
| book | Book 1 |
|
||||
| chat | Chat 1 |
|
||||
| data | Database 1 |
|
||||
| feedback | Feedback 1 |
|
||||
| forum | Forum 1 |
|
||||
| label | Label 1 |
|
||||
| lti | LTI 1 |
|
||||
| page | Page 1 |
|
||||
| quiz | Quiz 1 |
|
||||
| resource | Resource 1 |
|
||||
| imscp | IMSCP 1 |
|
||||
| folder | Folder 1 |
|
||||
| glossary | Glossary 1 |
|
||||
| scorm | Scorm 1 |
|
||||
| lesson | Lesson 1 |
|
||||
| survey | Survey 1 |
|
||||
| url | URL 1 |
|
||||
| wiki | Wiki 1 |
|
||||
| workshop | Workshop 1 |
|
||||
|
||||
Scenario: Display url activity description with pop-up display
|
||||
# Generate url activity with description and popup appearance
|
||||
Given the following "activities" exist:
|
||||
| activity | course | name | intro | showdescription | display | popupwidth | popupheight |
|
||||
| url | C1 | URL 1 | URL 1 intro | 1 | 6 | 620 | 450 |
|
||||
When I am on the "Course 1" course page logged in as teacher1
|
||||
# Confirm that activity name and description are displayed
|
||||
Then I should see "URL 1" in the "region-main" "region"
|
||||
And I should see "URL 1 intro" in the "region-main" "region"
|
||||
|
||||
Scenario: Display activity with image description
|
||||
# Generate page activity with image embedded in description
|
||||
Given the following "activities" exist:
|
||||
| activity | course | name | intro | showdescription |
|
||||
| page | C1 | Page 1 | Page 1 intro with image: <img src="http://download.moodle.org/unittest/test.jpg"> | 1 |
|
||||
When I am on the "Course 1" course page logged in as teacher1
|
||||
# Confirm that activity name and description are displayed
|
||||
Then I should see "Page 1" in the "region-main" "region"
|
||||
And I should see "Page 1 intro with image:" in the "region-main" "region"
|
||||
# Confirm that image element exists
|
||||
And "//img[contains(@src, 'http://download.moodle.org/unittest/test.jpg')]" "xpath_element" should exist in the "region-main" "region"
|
||||
@@ -362,6 +362,44 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
|
||||
core_course_external::update_categories($categories);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test update_categories method for moving categories
|
||||
*/
|
||||
public function test_update_categories_moving() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Create data.
|
||||
$categorya = self::getDataGenerator()->create_category([
|
||||
'name' => 'CAT_A',
|
||||
]);
|
||||
$categoryasub = self::getDataGenerator()->create_category([
|
||||
'name' => 'SUBCAT_A',
|
||||
'parent' => $categorya->id
|
||||
]);
|
||||
$categoryb = self::getDataGenerator()->create_category([
|
||||
'name' => 'CAT_B',
|
||||
]);
|
||||
|
||||
// Create a new test user.
|
||||
$testuser = self::getDataGenerator()->create_user();
|
||||
$this->setUser($testuser);
|
||||
|
||||
// Set the capability for CAT_A only.
|
||||
$contextcata = context_coursecat::instance($categorya->id);
|
||||
$roleid = $this->assignUserCapability('moodle/category:manage', $contextcata->id);
|
||||
|
||||
// Then we move SUBCAT_A parent: CAT_A => CAT_B.
|
||||
$categories = [
|
||||
[
|
||||
'id' => $categoryasub->id,
|
||||
'parent' => $categoryb->id
|
||||
]
|
||||
];
|
||||
|
||||
$this->expectException('required_capability_exception');
|
||||
core_course_external::update_categories($categories);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create_courses numsections
|
||||
*/
|
||||
|
||||
+16
-5
@@ -546,16 +546,27 @@ class course_enrolment_manager {
|
||||
*/
|
||||
public function search_users(string $search = '', bool $searchanywhere = false, int $page = 0, int $perpage = 25,
|
||||
bool $returnexactcount = false) {
|
||||
global $USER;
|
||||
|
||||
list($ufields, $params, $wherecondition) = $this->get_basic_search_conditions($search, $searchanywhere);
|
||||
|
||||
$groupmode = groups_get_course_groupmode($this->course);
|
||||
if ($groupmode == SEPARATEGROUPS && !has_capability('moodle/site:accessallgroups', $this->context)) {
|
||||
$groups = groups_get_all_groups($this->course->id, $USER->id, 0, 'g.id');
|
||||
$groupids = array_column($groups, 'id');
|
||||
} else {
|
||||
$groupids = [];
|
||||
}
|
||||
|
||||
[$enrolledsql, $enrolledparams] = get_enrolled_sql($this->context, '', $groupids);
|
||||
|
||||
$fields = 'SELECT ' . $ufields;
|
||||
$countfields = 'SELECT COUNT(u.id)';
|
||||
$sql = " FROM {user} u
|
||||
JOIN {user_enrolments} ue ON ue.userid = u.id
|
||||
JOIN {enrol} e ON ue.enrolid = e.id
|
||||
WHERE $wherecondition
|
||||
AND e.courseid = :courseid";
|
||||
$params['courseid'] = $this->course->id;
|
||||
JOIN ($enrolledsql) je ON je.id = u.id
|
||||
WHERE $wherecondition";
|
||||
|
||||
$params = array_merge($params, $enrolledparams);
|
||||
|
||||
return $this->execute_search_queries($search, $fields, $countfields, $sql, $params, $page, $perpage, 0, $returnexactcount);
|
||||
}
|
||||
|
||||
@@ -33,10 +33,11 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @category test
|
||||
* @copyright 2016 Ruslan Kabalin, Lancaster University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \course_enrolment_manager
|
||||
*/
|
||||
class core_course_enrolment_manager_testcase extends advanced_testcase {
|
||||
/**
|
||||
* The course context used in tests.
|
||||
* The course used in tests.
|
||||
* @var stdClass
|
||||
*/
|
||||
private $course = null;
|
||||
@@ -375,4 +376,57 @@ class core_course_enrolment_manager_testcase extends advanced_testcase {
|
||||
$this->assertArrayNotHasKey('totalusers', $users);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that search_users observes course group mode restrictions correctly
|
||||
*/
|
||||
public function test_search_users_course_groupmode(): void {
|
||||
global $DB, $PAGE;
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
||||
$teacher = $this->getDataGenerator()->create_and_enrol($this->course, 'teacher');
|
||||
$this->getDataGenerator()->create_group_member(['groupid' => $this->groups['group1']->id, 'userid' => $teacher->id]);
|
||||
$this->setUser($teacher);
|
||||
|
||||
$users = (new course_enrolment_manager($PAGE, $this->course))->search_users('', false, 0, 25, true);
|
||||
$this->assertEqualsCanonicalizing([
|
||||
$teacher->username,
|
||||
$this->users['user0']->username,
|
||||
$this->users['user1']->username,
|
||||
$this->users['user21']->username,
|
||||
$this->users['user22']->username,
|
||||
$this->users['userall']->username,
|
||||
$this->users['usertch']->username,
|
||||
], array_column($users['users'], 'username'));
|
||||
$this->assertEquals(7, $users['totalusers']);
|
||||
|
||||
// Switch course to separate groups.
|
||||
$this->course->groupmode = SEPARATEGROUPS;
|
||||
update_course($this->course);
|
||||
|
||||
$users = (new course_enrolment_manager($PAGE, $this->course))->search_users('', false, 0, 25, true);
|
||||
$this->assertEqualsCanonicalizing([
|
||||
$teacher->username,
|
||||
$this->users['user1']->username,
|
||||
$this->users['userall']->username,
|
||||
], array_column($users['users'], 'username'));
|
||||
$this->assertEquals(3, $users['totalusers']);
|
||||
|
||||
// Allow teacher to access all groups.
|
||||
$roleid = $DB->get_field('role', 'id', ['shortname' => 'teacher']);
|
||||
assign_capability('moodle/site:accessallgroups', CAP_ALLOW, $roleid, context_course::instance($this->course->id)->id);
|
||||
|
||||
$users = (new course_enrolment_manager($PAGE, $this->course))->search_users('', false, 0, 25, true);
|
||||
$this->assertEqualsCanonicalizing([
|
||||
$teacher->username,
|
||||
$this->users['user0']->username,
|
||||
$this->users['user1']->username,
|
||||
$this->users['user21']->username,
|
||||
$this->users['user22']->username,
|
||||
$this->users['userall']->username,
|
||||
$this->users['usertch']->username,
|
||||
], array_column($users['users'], 'username'));
|
||||
$this->assertEquals(7, $users['totalusers']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1122,6 +1122,43 @@ class core_enrollib_testcase extends advanced_testcase {
|
||||
$this->assertCount(1, enrol_get_course_users($course1->id, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* test_course_users in groups
|
||||
*
|
||||
* @covers \enrol_get_course_users()
|
||||
* @return void
|
||||
*/
|
||||
public function test_course_users_in_groups() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$user1 = $this->getDataGenerator()->create_user();
|
||||
$user2 = $this->getDataGenerator()->create_user();
|
||||
$user3 = $this->getDataGenerator()->create_user();
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$group1 = $this->getDataGenerator()->create_group(['courseid' => $course->id]);
|
||||
$group2 = $this->getDataGenerator()->create_group(['courseid' => $course->id]);
|
||||
|
||||
$this->getDataGenerator()->enrol_user($user1->id, $course->id);
|
||||
$this->getDataGenerator()->enrol_user($user2->id, $course->id);
|
||||
$this->getDataGenerator()->enrol_user($user3->id, $course->id);
|
||||
|
||||
$this->getDataGenerator()->create_group_member(['groupid' => $group1->id, 'userid' => $user1->id]);
|
||||
$this->getDataGenerator()->create_group_member(['groupid' => $group2->id, 'userid' => $user1->id]);
|
||||
$this->getDataGenerator()->create_group_member(['groupid' => $group2->id, 'userid' => $user2->id]);
|
||||
|
||||
$this->assertCount(3, enrol_get_course_users($course->id));
|
||||
$this->assertCount(1, enrol_get_course_users($course->id, false, [], [], [$group1->id]));
|
||||
$this->assertCount(2, enrol_get_course_users($course->id, false, [], [], [$group2->id]));
|
||||
|
||||
$instances = enrol_get_instances($course->id, true);
|
||||
$manualinstance = reset($instances);
|
||||
|
||||
$manualplugin = enrol_get_plugin('manual');
|
||||
$manualplugin->update_user_enrol($manualinstance, $user1->id, ENROL_USER_SUSPENDED);
|
||||
$this->assertCount(2, enrol_get_course_users($course->id, false, [], [], [$group2->id]));
|
||||
$this->assertCount(1, enrol_get_course_users($course->id, true, [], [], [$group2->id]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test count of enrolled users
|
||||
*
|
||||
|
||||
@@ -20,12 +20,10 @@ Feature: I need to export grades as text
|
||||
| activity | course | idnumber | name | intro | assignsubmission_onlinetext_enabled |
|
||||
| assign | C1 | a1 | Test assignment name | Submit your online text | 1 |
|
||||
| assign | C1 | a2 | Test assignment name 2 | Submit your online text | 1 |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I turn editing mode on
|
||||
And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment name"
|
||||
And I press "Save changes"
|
||||
And the following "grade grades" exist:
|
||||
| gradeitem | user | grade |
|
||||
| Test assignment name | student1 | 80.00 |
|
||||
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
|
||||
|
||||
@javascript
|
||||
Scenario: Export grades as text
|
||||
|
||||
@@ -19,15 +19,13 @@ Feature: I need to export grades as xml
|
||||
| student1 | C1 | student |
|
||||
| student2 | C1 | student |
|
||||
And the following "activities" exist:
|
||||
| activity | course | idnumber | name | intro |
|
||||
| assign | C1 | a1 | Test assignment name | Submit something! |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I turn editing mode on
|
||||
And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment name"
|
||||
And I give the grade "42.00" to the user "Student 2" for the grade item "Test assignment name"
|
||||
And I press "Save changes"
|
||||
| activity | course | idnumber | name |
|
||||
| assign | C1 | a1 | Test assignment name |
|
||||
And the following "grade grades" exist:
|
||||
| gradeitem | user | grade |
|
||||
| Test assignment name | student1 | 80.00 |
|
||||
| Test assignment name | student2 | 42.00 |
|
||||
And I am on the "Course 1" course page logged in as teacher1
|
||||
|
||||
@javascript
|
||||
Scenario: Export grades as XML
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
@gradingform @gradingform_guide
|
||||
Feature: Teacher can delete marking guide
|
||||
As a teacher,
|
||||
I should be able to delete a marking guide
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | One | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format |
|
||||
| Course 1 | C1 | topics |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And the following "activities" exist:
|
||||
| activity | course | name | advancedgradingmethod_submissions |
|
||||
| assign | C1 | Assign 1 | guide |
|
||||
And I am on the "Course 1" course page logged in as teacher1
|
||||
And I go to "Assign 1" advanced grading definition page
|
||||
And I set the following fields to these values:
|
||||
| Name | Marking guide 1 |
|
||||
And I define the following marking guide:
|
||||
| Criterion name | Description for students | Description for markers | Maximum score |
|
||||
| Criterion 1 | Criterion 1 description for student | Criterion 1 description for markers | 100 |
|
||||
And I press "Save marking guide and make it ready"
|
||||
|
||||
Scenario: Delete a marking guide
|
||||
Given I am on the "Course 1" course page
|
||||
And I go to "Assign 1" advanced grading page
|
||||
When I click on "Delete the currently defined form" "link"
|
||||
And I press "Cancel"
|
||||
# Confirm that marking guide was not deleted if Cancel is pressed
|
||||
Then I should see "Marking guide 1 Ready for use"
|
||||
And I should see "Criterion 1"
|
||||
And I click on "Delete the currently defined form" "link"
|
||||
And I press "Continue"
|
||||
# Confirm that marking guide was deleted successfully if Continue is pressed
|
||||
And I should see "Please note: the advanced grading form is not ready at the moment. Simple grading method will be used until the form has a valid status."
|
||||
And I should not see "Marking guide 1 Ready for use"
|
||||
And I should not see "Criterion 1"
|
||||
@@ -27,9 +27,9 @@
|
||||
|
||||
require_once(__DIR__ . '/../../../../../../lib/behat/behat_base.php');
|
||||
|
||||
use Behat\Gherkin\Node\TableNode as TableNode,
|
||||
Behat\Mink\Exception\ElementNotFoundException as ElementNotFoundException,
|
||||
Behat\Mink\Exception\ExpectationException as ExpectationException;
|
||||
use Behat\Gherkin\Node\TableNode;
|
||||
use Behat\Mink\Exception\ElementNotFoundException;
|
||||
use Behat\Mink\Exception\ExpectationException;
|
||||
|
||||
/**
|
||||
* Steps definitions to help with rubrics.
|
||||
@@ -66,7 +66,6 @@ class behat_gradingform_rubric extends behat_base {
|
||||
* @param TableNode $rubric
|
||||
*/
|
||||
public function i_define_the_following_rubric(TableNode $rubric) {
|
||||
|
||||
// Being a smart method is nothing good when we talk about step definitions, in
|
||||
// this case we didn't have any other options as there are no labels no elements
|
||||
// id we can point to without having to "calculate" them.
|
||||
@@ -80,7 +79,6 @@ class behat_gradingform_rubric extends behat_base {
|
||||
// Cleaning the current ones.
|
||||
$deletebuttons = $this->find_all('css', "input[value='" . get_string('criteriondelete', 'gradingform_rubric') . "']");
|
||||
if ($deletebuttons) {
|
||||
|
||||
// We should reverse the deletebuttons because otherwise once we delete
|
||||
// the first one the DOM will change and the [X] one will not exist anymore.
|
||||
$deletebuttons = array_reverse($deletebuttons, true);
|
||||
@@ -132,7 +130,10 @@ class behat_gradingform_rubric extends behat_base {
|
||||
}
|
||||
|
||||
// Add new criterion.
|
||||
$addcriterionbutton->click();
|
||||
$this->execute('behat_general::i_click_on', [
|
||||
$addcriterionbutton,
|
||||
'NodeElement',
|
||||
]);
|
||||
|
||||
$criterionroot = 'rubric[criteria][NEWID' . ($criterionit + 1) . ']';
|
||||
|
||||
@@ -158,12 +159,14 @@ class behat_gradingform_rubric extends behat_base {
|
||||
if ($this->running_javascript()) {
|
||||
$deletelevel = $this->find_button($criterionroot . '[levels][NEWID' . $i . '][delete]');
|
||||
$this->click_and_confirm($deletelevel);
|
||||
|
||||
} else {
|
||||
// Only if the level exists.
|
||||
$buttonname = $criterionroot . '[levels][NEWID' . $i . '][delete]';
|
||||
if ($deletelevel = $this->getSession()->getPage()->findButton($buttonname)) {
|
||||
$deletelevel->click();
|
||||
$this->execute('behat_general::i_click_on', [
|
||||
$deletelevel,
|
||||
'NodeElement',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -171,7 +174,10 @@ class behat_gradingform_rubric extends behat_base {
|
||||
// Adding levels if we don't have enough.
|
||||
$addlevel = $this->find_button($criterionroot . '[levels][addlevel]');
|
||||
for ($i = ($defaultnumberoflevels + 1); $i <= $nlevels; $i++) {
|
||||
$addlevel->click();
|
||||
$this->execute('behat_general::i_click_on', [
|
||||
$addlevel,
|
||||
'NodeElement',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,7 +232,6 @@ class behat_gradingform_rubric extends behat_base {
|
||||
* @param string $criterionname
|
||||
*/
|
||||
public function i_replace_rubric_level_with($currentvalue, $value, $criterionname) {
|
||||
|
||||
$currentvalueliteral = behat_context_helper::escape($currentvalue);
|
||||
$criterionliteral = behat_context_helper::escape($criterionname);
|
||||
|
||||
@@ -247,14 +252,15 @@ class behat_gradingform_rubric extends behat_base {
|
||||
"/descendant::textarea[text()=$currentvalueliteral]";
|
||||
|
||||
if ($this->running_javascript()) {
|
||||
|
||||
$spansufix = "/ancestor::div[@class='level-wrapper']" .
|
||||
"/descendant::div[@class='definition']" .
|
||||
"/descendant::span[@class='textvalue']";
|
||||
|
||||
// Expanding the level input boxes.
|
||||
$spannode = $this->find('xpath', $inputxpath . $spansufix . '|' . $textareaxpath . $spansufix);
|
||||
$spannode->click();
|
||||
$this->execute('behat_general::i_click_on', [
|
||||
$inputxpath . $spansufix . '|' . $textareaxpath . $spansufix,
|
||||
'xpath',
|
||||
]);
|
||||
|
||||
$inputfield = $this->find('xpath', $inputxpath . '|' . $textareaxpath);
|
||||
$inputfield->setValue($value);
|
||||
@@ -263,7 +269,6 @@ class behat_gradingform_rubric extends behat_base {
|
||||
$fieldnode = $this->find('xpath', $inputxpath . '|' . $textareaxpath);
|
||||
$this->set_rubric_field_value($fieldnode->getAttribute('name'), $value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -275,7 +280,6 @@ class behat_gradingform_rubric extends behat_base {
|
||||
* @param TableNode $rubric
|
||||
*/
|
||||
public function i_grade_by_filling_the_rubric_with(TableNode $rubric) {
|
||||
|
||||
$criteria = $rubric->getRowsHash();
|
||||
|
||||
$stepusage = '"I grade by filling the rubric with:" step needs you to provide a table where each row is a criterion' .
|
||||
@@ -288,7 +292,6 @@ class behat_gradingform_rubric extends behat_base {
|
||||
|
||||
// First element -> name, second -> points, third -> Remark.
|
||||
foreach ($criteria as $name => $criterion) {
|
||||
|
||||
// We only expect the points and the remark, as the criterion name is $name.
|
||||
if (count($criterion) !== 2) {
|
||||
throw new ExpectationException($stepusage, $this->getSession());
|
||||
@@ -349,7 +352,6 @@ class behat_gradingform_rubric extends behat_base {
|
||||
* @return void
|
||||
*/
|
||||
public function the_level_with_points_was_previously_selected_for_the_rubric_criterion($points, $criterionname) {
|
||||
|
||||
$levelxpath = $this->get_criterion_xpath($criterionname) .
|
||||
$this->get_level_xpath($points) .
|
||||
"[contains(concat(' ', normalize-space(@class), ' '), ' currentchecked ')]";
|
||||
@@ -378,7 +380,6 @@ class behat_gradingform_rubric extends behat_base {
|
||||
* @return void
|
||||
*/
|
||||
public function the_level_with_points_is_selected_for_the_rubric_criterion($points, $criterionname) {
|
||||
|
||||
$levelxpath = $this->get_criterion_xpath($criterionname) .
|
||||
$this->get_level_xpath($points);
|
||||
|
||||
@@ -409,7 +410,6 @@ class behat_gradingform_rubric extends behat_base {
|
||||
* @return void
|
||||
*/
|
||||
public function the_level_with_points_is_not_selected_for_the_rubric_criterion($points, $criterionname) {
|
||||
|
||||
$levelxpath = $this->get_criterion_xpath($criterionname) .
|
||||
$this->get_level_xpath($points);
|
||||
|
||||
@@ -437,12 +437,13 @@ class behat_gradingform_rubric extends behat_base {
|
||||
* @return void
|
||||
*/
|
||||
protected function set_rubric_field_value($name, $value, $visible = false) {
|
||||
|
||||
// Fields are hidden by default.
|
||||
if ($this->running_javascript() == true && $visible === false) {
|
||||
$xpath = "//*[@name='$name']/following-sibling::*[contains(concat(' ', normalize-space(@class), ' '), ' plainvalue ')]";
|
||||
$textnode = $this->find('xpath', $xpath);
|
||||
$textnode->click();
|
||||
$this->execute('behat_general::i_click_on', [
|
||||
$xpath,
|
||||
'xpath',
|
||||
]);
|
||||
}
|
||||
|
||||
// Set the value now.
|
||||
@@ -457,19 +458,20 @@ class behat_gradingform_rubric extends behat_base {
|
||||
* @return void
|
||||
*/
|
||||
protected function click_and_confirm($node) {
|
||||
|
||||
// Clicks to perform the action.
|
||||
$node->click();
|
||||
$this->execute('behat_general::i_click_on', [
|
||||
$node,
|
||||
'NodeElement',
|
||||
]);
|
||||
|
||||
// Confirms the delete.
|
||||
if ($this->running_javascript()) {
|
||||
$confirmbutton = $this->get_node_in_container(
|
||||
'button',
|
||||
$this->execute('behat_general::i_click_on_in_the', [
|
||||
get_string('yes'),
|
||||
'button',
|
||||
get_string('confirmation', 'admin'),
|
||||
'dialogue',
|
||||
get_string('confirmation', 'admin')
|
||||
);
|
||||
$confirmbutton->click();
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,8 +67,10 @@ class gradeimport_csv_renderer extends plugin_renderer_base {
|
||||
$html = $this->output->heading(get_string('importpreview', 'grades'));
|
||||
|
||||
$table = new html_table();
|
||||
$table->head = $header;
|
||||
$table->data = $data;
|
||||
$table->head = array_map('s', $header);
|
||||
$table->data = array_map(static function($row) {
|
||||
return array_map('s', $row);
|
||||
}, $data);
|
||||
$html .= html_writer::table($table);
|
||||
|
||||
return $html;
|
||||
|
||||
@@ -75,8 +75,7 @@ Feature: We can change what we are viewing on the grader report
|
||||
And the following "role capability" exists:
|
||||
| role | editingteacher |
|
||||
| moodle/grade:viewhidden | prevent |
|
||||
And I am on the "C1" "course" page logged in as "teacher1"
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
|
||||
Then I should see "Test assignment name 1" in the "user-grades" "table"
|
||||
And I should see "Test assignment name 2" in the "user-grades" "table"
|
||||
And I should see "Manual grade"
|
||||
|
||||
@@ -22,22 +22,17 @@ Feature: A teacher checks the grade history report in a course
|
||||
| student1 | C1 | student |
|
||||
| student2 | C1 | student |
|
||||
And the following "activities" exist:
|
||||
| activity | course | section | name | intro |
|
||||
| assign | C1 | 1 | The greatest assignment ever | Write a behat test for Moodle - it's amazing |
|
||||
| assign | C1 | 1 | Rewarding assignment | After writing your behat test go grab a beer! |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
| activity | course | name |
|
||||
| assign | C1 | The greatest assignment ever |
|
||||
| assign | C1 | Rewarding assignment |
|
||||
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
|
||||
And I turn editing mode on
|
||||
And I give the grade "50.00" to the user "Student 1" for the grade item "The greatest assignment ever"
|
||||
And I give the grade "60.00" to the user "Student 1" for the grade item "Rewarding assignment"
|
||||
And I give the grade "50.00" to the user "Student 2" for the grade item "The greatest assignment ever"
|
||||
And I give the grade "60.00" to the user "Student 2" for the grade item "Rewarding assignment"
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
And I log in as "teacher2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher2"
|
||||
And I turn editing mode on
|
||||
And I give the grade "70.00" to the user "Student 1" for the grade item "The greatest assignment ever"
|
||||
And I give the grade "80.00" to the user "Student 1" for the grade item "Rewarding assignment"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@core @core_grades @gradereport_singleview
|
||||
@core @core_grades @gradereport_singleview @javascript
|
||||
Feature: We can use Single view
|
||||
As a teacher
|
||||
In order to view and edit grades
|
||||
@@ -7,7 +7,7 @@ Feature: We can use Single view
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email | idnumber | middlename | alternatename | firstnamephonetic | lastnamephonetic |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com | t1 | | fred | | |
|
||||
@@ -53,11 +53,8 @@ Feature: We can use Single view
|
||||
And the following config values are set as admin:
|
||||
| fullnamedisplay | firstnamephonetic,lastnamephonetic |
|
||||
| alternativefullnameformat | middlename, alternatename, firstname, lastname |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
Given I navigate to "View > Grader report" in the course gradebook
|
||||
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
|
||||
|
||||
@javascript
|
||||
Scenario: I can update grades, add feedback and exclude grades.
|
||||
Given I navigate to "View > Single view" in the course gradebook
|
||||
And I select "Student" from the "Select user..." singleselect
|
||||
@@ -97,10 +94,7 @@ Feature: We can use Single view
|
||||
And the following should exist in the "generaltable" table:
|
||||
| First name (Alternate name) Surname | Grade |
|
||||
| Ann, Jill, Grainne, Beauchamp | Very good |
|
||||
And I log out
|
||||
And I log in as "teacher2"
|
||||
And I am on "Course 1" course homepage
|
||||
Given I navigate to "View > Single view" in the course gradebook
|
||||
And I am on the "Course 1" "grades > Single view > View" page logged in as "teacher2"
|
||||
And I select "Student" from the "Select user..." singleselect
|
||||
And the "Exclude for Test assignment one" "checkbox" should be disabled
|
||||
And the "Override for Test assignment one" "checkbox" should be enabled
|
||||
|
||||
@@ -30,9 +30,7 @@ Feature: View the user report as the student will see it
|
||||
| activity | course | idnumber | name | intro | grade |
|
||||
| assign | C1 | a5 | Test assignment five | Submit something! | 100 |
|
||||
| assign | C1 | a6 | Test assignment six | Submit something! | 100 |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
When I am on the "C1" "grades > gradebook setup" page logged in as "teacher1"
|
||||
And I hide the grade item "Test assignment six"
|
||||
And I hide the grade item "Sub category 2"
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
|
||||
@@ -5,12 +5,10 @@ Feature: We can use the user report
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
| fullname | shortname | category | groupmode |
|
||||
| Course 1 | C1 | 0 | 1 |
|
||||
|
||||
Scenario: Verify we can view a user grade report with no users enrolled.
|
||||
Given I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > User report" in the course gradebook
|
||||
When I am on the "Course 1" "grades > User report > View" page logged in as "admin"
|
||||
And I select "All users (0)" from the "Select all or one user" singleselect
|
||||
Then I should see "There are no students enrolled in this course."
|
||||
|
||||
@@ -35,6 +35,8 @@ class behat_grades extends behat_base {
|
||||
* | [report] view | Course name | The view page for the specified course and report |
|
||||
* | gradebook setup | Course name | The gradebook setup page for the specified course |
|
||||
* | course grade settings | Course name | The grade settings page |
|
||||
* | outcomes | Course name | The grade outcomes page |
|
||||
* | scales | Course name | The grade scales page |
|
||||
*
|
||||
* @param string $type identifies which type of page this is - for example "Grader > View"
|
||||
* @param string $identifier identifies the particular page - for example "Course name"
|
||||
@@ -86,6 +88,16 @@ class behat_grades extends behat_base {
|
||||
"/grade/edit/settings/index.php",
|
||||
['id' => $this->get_course_id($identifier)]
|
||||
);
|
||||
case 'outcomes':
|
||||
return new moodle_url(
|
||||
"/grade/edit/outcome/course.php",
|
||||
['id' => $this->get_course_id($identifier)]
|
||||
);
|
||||
case 'scales':
|
||||
return new moodle_url(
|
||||
"/grade/edit/scale/index.php",
|
||||
['id' => $this->get_course_id($identifier)]
|
||||
);
|
||||
default:
|
||||
throw new \coding_exception(
|
||||
"Unknown page type '$type' for page identifier '$identifier'"
|
||||
|
||||
@@ -17,9 +17,7 @@ Feature: Site settings can be used to hide parts of the gradebook UI
|
||||
And the following "activities" exist:
|
||||
| activity | course | idnumber | name | intro |
|
||||
| assign | C1 | assign1 | Assignment1 | Assignment 1 intro |
|
||||
And I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I am on the "Course 1" "grades > Grader report > View" page logged in as "admin"
|
||||
And I turn editing mode on
|
||||
|
||||
@javascript
|
||||
@@ -29,8 +27,7 @@ Feature: Site settings can be used to hide parts of the gradebook UI
|
||||
Then I navigate to "Grades > General settings" in site administration
|
||||
And I set the field "Show minimum grade" to "0"
|
||||
And I press "Save changes"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I am on the "Course 1" "grades > Grader report > View" page
|
||||
And I click on "Edit assign Assignment1" "link"
|
||||
And I should not see "Minimum grade"
|
||||
|
||||
@@ -46,10 +43,9 @@ Feature: Site settings can be used to hide parts of the gradebook UI
|
||||
|
||||
@javascript
|
||||
Scenario: Disable category overriding
|
||||
And "tr .course input[type='text']" "css_element" should exist
|
||||
Then I navigate to "Grades > Grade category settings" in site administration
|
||||
Given "Student 1 Course total" "field" should exist
|
||||
And I navigate to "Grades > Grade category settings" in site administration
|
||||
And I set the field "Allow category grades to be manually overridden" to "0"
|
||||
And I press "Save changes"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And "tr .course input[type='text']" "css_element" should not exist
|
||||
When I am on the "Course 1" "grades > Grader report > View" page
|
||||
Then "Student 1 Course total" "field" should not exist
|
||||
|
||||
@@ -39,20 +39,18 @@ Feature: We can use calculated grade totals
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| grade_aggregations_visible | Mean of grades,Weighted mean of grades,Simple weighted mean of grades,Mean of grades (with extra credits),Median of grades,Lowest grade,Highest grade,Mode of grades,Natural |
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And the following "grade grades" exist:
|
||||
| gradeitem | user | grade |
|
||||
| Test assignment one | student1 | 60.00 |
|
||||
| Test assignment two | student1 | 20.00 |
|
||||
| Test assignment three | student1 | 40.00 |
|
||||
| Test assignment five | student1 | 10.00 |
|
||||
| Test assignment six | student1 | 5.00 |
|
||||
| Test assignment eight | student1 | 10.00 |
|
||||
| Test assignment nine | student1 | 5.00 |
|
||||
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
|
||||
And I turn editing mode on
|
||||
And I change window size to "large"
|
||||
And I give the grade "60.00" to the user "Student 1" for the grade item "Test assignment one"
|
||||
And I give the grade "20.00" to the user "Student 1" for the grade item "Test assignment two"
|
||||
And I give the grade "40.00" to the user "Student 1" for the grade item "Test assignment three"
|
||||
And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment five"
|
||||
And I give the grade "5.00" to the user "Student 1" for the grade item "Test assignment six"
|
||||
And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment eight"
|
||||
And I give the grade "5.00" to the user "Student 1" for the grade item "Test assignment nine"
|
||||
And I press "Save changes"
|
||||
And I set the following settings for grade item "Test assignment two":
|
||||
| Hidden | 1 |
|
||||
And I set the following settings for grade item "Test assignment five":
|
||||
@@ -254,10 +252,7 @@ Feature: We can use calculated grade totals
|
||||
Then I should see "114.82 (18.27 %)" in the "overview-grade" "table"
|
||||
And I click on "Course 1" "link" in the "region-main" "region"
|
||||
And "Test outcome item one" row "Grade" column of "user-grade" table should contain "Excellent (100.00 %)"
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
|
||||
And I set the following settings for grade item "Test outcome item one":
|
||||
| Extra credit | 1 |
|
||||
And I log out
|
||||
@@ -266,10 +261,7 @@ Feature: We can use calculated grade totals
|
||||
Then I should see "114.00 (18.39 %)" in the "overview-grade" "table"
|
||||
And I click on "Course 1" "link" in the "region-main" "region"
|
||||
And "Test outcome item one" row "Grade" column of "user-grade" table should contain "Excellent (100.00 %)"
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
|
||||
And I set the following settings for grade item "Course 1":
|
||||
| Aggregation | Natural |
|
||||
| Include outcomes in aggregation | 0 |
|
||||
@@ -368,10 +360,7 @@ Feature: We can use calculated grade totals
|
||||
| Test assignment four | 30.93 % | - | 0–150 | 0.00 % |
|
||||
|
||||
Scenario: Natural aggregation with drop lowest
|
||||
When I log out
|
||||
And I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
When I am on the "Course 1" "grades > Grader report > View" page logged in as "admin"
|
||||
And I turn editing mode on
|
||||
And I set the following settings for grade item "Sub category 1":
|
||||
| Aggregation | Natural |
|
||||
|
||||
@@ -33,8 +33,7 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| grade_aggregations_visible | Mean of grades,Weighted mean of grades,Simple weighted mean of grades,Mean of grades (with extra credits),Median of grades,Lowest grade,Highest grade,Mode of grades,Natural |
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I am on the "Course 1" "grades > Grader report > View" page
|
||||
And I turn editing mode on
|
||||
And I follow "Edit Cat mean"
|
||||
And I set the following fields to these values:
|
||||
|
||||
@@ -18,9 +18,7 @@ Feature: Calculated grade items can be used in the gradebook
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
| student2 | C1 | student |
|
||||
And I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
And I am on the "Course 1" "grades > gradebook setup" page logged in as "admin"
|
||||
|
||||
@javascript
|
||||
Scenario: The max grade for a category item, with a calculation using Natural aggregation, can be changed
|
||||
|
||||
@@ -19,9 +19,7 @@ Feature: Gradebook calculations for calculated grade items before the fix 201506
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
| student2 | C1 | student |
|
||||
And I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
And I am on the "Course 1" "grades > gradebook setup" page logged in as "admin"
|
||||
|
||||
@javascript
|
||||
Scenario: The max grade for a category item, with a calculation using Natural aggregation, can be changed
|
||||
|
||||
@@ -29,10 +29,7 @@ Feature: We can understand the gradebook user report
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| grade_aggregations_visible | Mean of grades,Weighted mean of grades,Simple weighted mean of grades,Mean of grades (with extra credits),Median of grades,Lowest grade,Highest grade,Mode of grades,Natural |
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I am on the "Course 1" "grades > Grader report > View" page logged in as teacher1
|
||||
And I turn editing mode on
|
||||
And I give the grade "60.00" to the user "Student 1" for the grade item "EN Test assignment one"
|
||||
And I give the grade "20.00" to the user "Student 1" for the grade item "EN Test assignment two"
|
||||
|
||||
@@ -19,8 +19,7 @@ Feature: Extra credit contributions are normalised when going out of bounds
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| grade_aggregations_visible | Simple weighted mean of grades,Mean of grades (with extra credits),Natural |
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
And I am on the "Course 1" "grades > gradebook setup" page
|
||||
And I press "Add grade item"
|
||||
And I set the following fields to these values:
|
||||
| Item name | Manual item 1 |
|
||||
@@ -42,10 +41,7 @@ Feature: Extra credit contributions are normalised when going out of bounds
|
||||
And I set the field "Show weighting" to "Show"
|
||||
And I set the field "Show contribution to course total" to "Show"
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
|
||||
And I turn editing mode on
|
||||
And I give the grade "80.00" to the user "Student 1" for the grade item "Manual item 1"
|
||||
And I give the grade "10.00" to the user "Student 1" for the grade item "Manual item 2"
|
||||
|
||||
@@ -19,9 +19,7 @@ Feature: We can change the maximum and minimum number of points for manual items
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
| student2 | C1 | student |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
|
||||
And I press "Add grade item"
|
||||
And I set the following fields to these values:
|
||||
| Item name | Manual item 1 |
|
||||
@@ -34,8 +32,7 @@ Feature: We can change the maximum and minimum number of points for manual items
|
||||
And I press "Save changes"
|
||||
|
||||
Scenario: Change maximum number of points on a graded item.
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
Given I am on the "Course 1" "grades > Grader report > View" page
|
||||
And I turn editing mode on
|
||||
And I give the grade "10.00" to the user "Student 1" for the grade item "Manual item 1"
|
||||
And I give the grade "8.00" to the user "Student 2" for the grade item "Manual item 1"
|
||||
|
||||
@@ -29,8 +29,7 @@ Feature: Student and teacher's view of aggregated grade items is consistent when
|
||||
And I log in as "admin"
|
||||
And the "multilang" filter is "on"
|
||||
And the "multilang" filter applies to "content and headings"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
And I am on the "Course 1" "grades > gradebook setup" page
|
||||
And I press "Add grade item"
|
||||
And I set the following fields to these values:
|
||||
| Item name | calculated |
|
||||
@@ -42,10 +41,7 @@ Feature: Student and teacher's view of aggregated grade items is consistent when
|
||||
And I navigate to "Grades > Report settings > User report" in site administration
|
||||
And I set the field "s__grade_report_user_showtotalsifcontainhidden" to "Show totals excluding hidden items"
|
||||
And I press "Save changes"
|
||||
When I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
When I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
|
||||
And I turn editing mode on
|
||||
And I give the grade "50.00" to the user "Student 1" for the grade item "Test assignment one"
|
||||
And I give the grade "50.00" to the user "Student 1" for the grade item "Test assignment three"
|
||||
@@ -53,8 +49,7 @@ Feature: Student and teacher's view of aggregated grade items is consistent when
|
||||
And I set the following settings for grade item "Test assignment four":
|
||||
| Hidden | 1 |
|
||||
And I press "Save changes"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > User report" in the course gradebook
|
||||
And I am on the "Course 1" "grades > User report > View" page
|
||||
And I select "Myself" from the "View report as" singleselect
|
||||
And I select "Student 1" from the "Select all or one user" singleselect
|
||||
Then the following should exist in the "user-grade" table:
|
||||
@@ -63,10 +58,7 @@ Feature: Student and teacher's view of aggregated grade items is consistent when
|
||||
| Test assignment two | 0.00 %( Empty ) | - | 0–100 | - | 0.00 % |
|
||||
| Test assignment three | 100.00 % | 50.00 | 0–100 | 50.00 % | 25.00 % |
|
||||
| Course total | - | 100.00 | 0–200 | 50.00 % | - |
|
||||
When I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "User report" in the course gradebook
|
||||
When I am on the "Course 1" "grades > User report > View" page logged in as "student1"
|
||||
Then the following should exist in the "user-grade" table:
|
||||
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
|
||||
| Test assignment one | 100.00 % | 50.00 | 0–100 | 50.00 % | 25.00 % |
|
||||
|
||||
@@ -17,9 +17,7 @@ Feature: Hidden grade items should be hidden when grade category is locked, but
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
And I am on the "Course 1" "grades > gradebook setup" page logged in as "admin"
|
||||
And I press "Add category"
|
||||
And I set the following fields to these values:
|
||||
| Category name | Test locked category |
|
||||
@@ -30,23 +28,16 @@ Feature: Hidden grade items should be hidden when grade category is locked, but
|
||||
| Hidden | 1 |
|
||||
| Grade category | Test locked category |
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
|
||||
And I turn editing mode on
|
||||
And I give the grade "50.00" to the user "Student 1" for the grade item "Hidden item"
|
||||
And I press "Save changes"
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
And I set the following settings for grade item "Test locked category":
|
||||
| Locked | 1 |
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
|
||||
Scenario: Hidden grade items in locked category is hidden for teacher
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > User report" in the course gradebook
|
||||
Given I am on the "Course 1" "grades > User report > View" page logged in as teacher1
|
||||
And I select "Myself" from the "View report as" singleselect
|
||||
When I select "Student 1" from the "Select all or one user" singleselect
|
||||
Then the following should exist in the "user-grade" table:
|
||||
@@ -55,9 +46,7 @@ Feature: Hidden grade items should be hidden when grade category is locked, but
|
||||
| Course total | - | 50.00 | 0–100 | 50.00 % | - |
|
||||
|
||||
Scenario: Hidden grade items in locked category is hidden for student
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I navigate to "User report" in the course gradebook
|
||||
When I am on the "Course 1" "grades > User report > View" page logged in as student1
|
||||
Then the following should exist in the "user-grade" table:
|
||||
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
|
||||
| Test locked category total | 100.00 % | - | 0–100 | - | - |
|
||||
@@ -65,9 +54,7 @@ Feature: Hidden grade items should be hidden when grade category is locked, but
|
||||
And I should not see "Hidden item"
|
||||
|
||||
Scenario: Hidden grade items in overridden category should show
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
Given I am on the "Course 1" "grades > gradebook setup" page
|
||||
And I press "Add category"
|
||||
And I set the following fields to these values:
|
||||
| Category name | Test overridden category B|
|
||||
@@ -78,13 +65,9 @@ Feature: Hidden grade items should be hidden when grade category is locked, but
|
||||
| Grade category | Test overridden category B |
|
||||
And I press "Save changes"
|
||||
When I navigate to "View > Grader report" in the course gradebook
|
||||
And I turn editing mode on
|
||||
And I give the grade "50.00" to the user "Student 1" for the grade item "Test overridden category B total"
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "User report" in the course gradebook
|
||||
And I am on the "Course 1" "grades > User report > View" page logged in as "student1"
|
||||
Then the following should exist in the "user-grade" table:
|
||||
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
|
||||
| Test locked category total | 50.00 % | - | 0–100 | - | - |
|
||||
|
||||
@@ -25,9 +25,7 @@ Feature: We can duplicate grade items that already exist.
|
||||
| Item1 | C1 | Category1 | 001 | Value | 80.00 | 5.00 | 40.00 | 1 | 1 | 0 | 1 |
|
||||
|
||||
Scenario: Ensure the duplicated grade item settings match the original grade item
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
Given I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
|
||||
And I should not see "Duplicate Category1"
|
||||
And I should not see "Duplicate Assignment1"
|
||||
When I duplicate the grade item "Item1"
|
||||
|
||||
@@ -30,8 +30,7 @@ Feature: Grade item validation
|
||||
| Name | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Letter scale |
|
||||
| Scale | Disappointing, Good, Very good, Excellent |
|
||||
And I press "Save changes"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
And I am on the "Course 1" "grades > gradebook setup" page
|
||||
And I press "Add grade item"
|
||||
And I set the following fields to these values:
|
||||
| Item name | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> MI 1 |
|
||||
|
||||
@@ -20,9 +20,7 @@ Feature: We can customise the letter boundary of a course.
|
||||
And the following "activities" exist:
|
||||
| activity | course | idnumber | name | intro | grade |
|
||||
| assign | C1 | a1 | Test assignment one | Submit something! | 100 |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Course grade settings" in the course gradebook
|
||||
And I am on the "Course 1" "grades > course grade settings" page logged in as "teacher1"
|
||||
And I set the following fields to these values:
|
||||
| Grade display type | Letter |
|
||||
And I press "Save changes"
|
||||
|
||||
@@ -21,9 +21,7 @@ Feature: We can customise the letter boundary of a course in gradebook version 2
|
||||
And the following "activities" exist:
|
||||
| activity | course | idnumber | name | intro | grade |
|
||||
| assign | C1 | a1 | Test assignment one | Submit something! | 100 |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Course grade settings" in the course gradebook
|
||||
And I am on the "Course 1" "grades > course grade settings" page logged in as "teacher1"
|
||||
And I set the following fields to these values:
|
||||
| Grade display type | Letter |
|
||||
And I press "Save changes"
|
||||
|
||||
@@ -8,9 +8,7 @@ Feature: We can view the logs for any changes to grade letters.
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Course grade settings" in the course gradebook
|
||||
And I am on the "Course 1" "grades > course grade settings" page logged in as "admin"
|
||||
And I set the following fields to these values:
|
||||
| Grade display type | Letter |
|
||||
And I press "Save changes"
|
||||
|
||||
@@ -19,51 +19,23 @@ Feature: We can use a minimum grade different than zero
|
||||
| student1 | C1 | student |
|
||||
| student2 | C1 | student |
|
||||
And the following "grade categories" exist:
|
||||
| fullname | course |
|
||||
| Sub category 1 | C1 |
|
||||
| Sub category 2 | C1 |
|
||||
| fullname | course | aggregateonlygraded |
|
||||
| Sub category 1 | C1 | 0 |
|
||||
| Sub category 2 | C1 | 0 |
|
||||
And the following "grade items" exist:
|
||||
| itemname | grademin | course |
|
||||
| Manual item 1 | -100 | C1 |
|
||||
| Manual item 2 | 50 | C1 |
|
||||
And the following "grade items" exist:
|
||||
| itemname | grademin | grademax | course | gradecategory |
|
||||
| Manual item 3 | -100 | 50 | C1 | Sub category 1 |
|
||||
And the following "grade items" exist:
|
||||
| itemname | grademin | course | gradecategory |
|
||||
| Manual item 4 | -100 | C1 | Sub category 1 |
|
||||
| Manual item 5 | 50 | C1 | Sub category 2 |
|
||||
| Manual item 6 | 50 | C1 | Sub category 2 |
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| grade_aggregations_visible | Mean of grades,Weighted mean of grades,Simple weighted mean of grades,Mean of grades (with extra credits),Median of grades,Lowest grade,Highest grade,Mode of grades,Natural |
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
And I press "Add grade item"
|
||||
And I set the following fields to these values:
|
||||
| Item name | Manual item 1 |
|
||||
| Minimum grade | -100 |
|
||||
| Grade category | Course 1 |
|
||||
And I press "Save changes"
|
||||
And I press "Add grade item"
|
||||
And I set the following fields to these values:
|
||||
| Item name | Manual item 2 |
|
||||
| Minimum grade | 50 |
|
||||
| Grade category | Course 1 |
|
||||
And I press "Save changes"
|
||||
And I press "Add grade item"
|
||||
And I set the following fields to these values:
|
||||
| Item name | Manual item 3 |
|
||||
| Maximum grade | 50 |
|
||||
| Minimum grade | -100 |
|
||||
| Grade category | Sub category 1 |
|
||||
And I press "Save changes"
|
||||
And I press "Add grade item"
|
||||
And I set the following fields to these values:
|
||||
| Item name | Manual item 4 |
|
||||
| Minimum grade | -100 |
|
||||
| Grade category | Sub category 1 |
|
||||
And I press "Save changes"
|
||||
And I press "Add grade item"
|
||||
And I set the following fields to these values:
|
||||
| Item name | Manual item 5 |
|
||||
| Minimum grade | 50 |
|
||||
| Grade category | Sub category 2 |
|
||||
And I press "Save changes"
|
||||
And I press "Add grade item"
|
||||
And I set the following fields to these values:
|
||||
| Item name | Manual item 6 |
|
||||
| Minimum grade | 50 |
|
||||
| Grade category | Sub category 2 |
|
||||
And I press "Save changes"
|
||||
And I am on the "Course 1" "grades > gradebook setup" page
|
||||
And I navigate to "Setup > Course grade settings" in the course gradebook
|
||||
And I set the field "Show weightings" to "Show"
|
||||
And I set the field "Show contribution to course total" to "Show"
|
||||
@@ -71,20 +43,11 @@ Feature: We can use a minimum grade different than zero
|
||||
|
||||
@javascript
|
||||
Scenario: Natural aggregation with negative and positive grade
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
And I set the following settings for grade item "Sub category 1":
|
||||
| Aggregation | Natural |
|
||||
| Exclude empty grades | 0 |
|
||||
And I set the following settings for grade item "Sub category 2":
|
||||
| Aggregation | Natural |
|
||||
| Exclude empty grades | 0 |
|
||||
Given I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
And I set the following settings for grade item "Course 1":
|
||||
| Aggregation | Natural |
|
||||
| Exclude empty grades | 0 |
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
|
||||
And I turn editing mode on
|
||||
When I give the grade "-25.00" to the user "Student 1" for the grade item "Manual item 1"
|
||||
And I give the grade "50.00" to the user "Student 1" for the grade item "Manual item 2"
|
||||
|
||||
@@ -24,8 +24,7 @@ Feature: We can choose what min or max grade to use when aggregating grades.
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| grade_minmaxtouse | Min and max grades as specified in grade item settings |
|
||||
And I am on "C1" course homepage
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
And I am on the "C1" "grades > gradebook setup" page
|
||||
And I press "Add grade item"
|
||||
And I set the following fields to these values:
|
||||
| Item name | MI 1 |
|
||||
@@ -63,10 +62,7 @@ Feature: We can choose what min or max grade to use when aggregating grades.
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
And I set the following settings for grade item "CAT1":
|
||||
| Aggregation | Natural |
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "C1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I am on the "C1" "grades > Grader report > View" page logged in as "teacher1"
|
||||
And I turn editing mode on
|
||||
And I give the grade "75.00" to the user "Student 1" for the grade item "MI 1"
|
||||
And I give the grade "25.00" to the user "Student 1" for the grade item "MI 2"
|
||||
|
||||
@@ -23,9 +23,7 @@ Feature: Weights in natural aggregation are adjusted if the items are excluded f
|
||||
| assign | C1 | a3 | Test assignment three | x | 200 |
|
||||
| assign | C1 | a4 | Test assignment four (extra) | x | 20 |
|
||||
| assign | C1 | a5 | Test assignment five (extra) | x | 10 |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
|
||||
And I set the following settings for grade item "Test assignment four (extra)":
|
||||
| Extra credit | 1 |
|
||||
And I set the following settings for grade item "Test assignment five (extra)":
|
||||
|
||||
@@ -24,9 +24,7 @@ Feature: Gradebook calculations for extra credit items before the fix 20150619
|
||||
| assign | C1 | a3 | Test assignment three | x | 200 |
|
||||
| assign | C1 | a4 | Test assignment four (extra) | x | 20 |
|
||||
| assign | C1 | a5 | Test assignment five (extra) | x | 10 |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
|
||||
And I set the following settings for grade item "Test assignment four (extra)":
|
||||
| Extra credit | 1 |
|
||||
And I set the following settings for grade item "Test assignment five (extra)":
|
||||
|
||||
@@ -32,9 +32,7 @@ Feature: We can use natural aggregation and weights will be normalised to a tota
|
||||
| assign | C1 | a7 | Test assignment seven | Submit nothing! | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Sub category 1 | 15 |
|
||||
And the "multilang" filter is "on"
|
||||
And the "multilang" filter applies to "content and headings"
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
|
||||
|
||||
@javascript
|
||||
Scenario: Setting all weights in a category to exactly one hundred in total.
|
||||
|
||||
@@ -31,9 +31,7 @@ Feature: Gradebook calculations for natural weights normalisation before the fix
|
||||
| assign | C1 | a5 | Test assignment five | Submit something! | Sub category 1 | 20 |
|
||||
| assign | C1 | a6 | Test assignment six | Submit something! | Sub category 1 | 10 |
|
||||
| assign | C1 | a7 | Test assignment seven | Submit nothing! | Sub category 1 | 15 |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
|
||||
|
||||
@javascript
|
||||
Scenario: Grade items weights are normalised when all grade item weights are overridden (sum exactly 100). Extra credit is set to zero (before the fix 20150619).
|
||||
|
||||
@@ -31,8 +31,7 @@ Feature: Regrading grades does not unnecessarily mark some as overriden
|
||||
And I press "OK"
|
||||
And I set the field "Grade out of 100" to "60"
|
||||
And I press "Save changes"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I am on the "Course 1" "grades > Grader report > View" page
|
||||
And the following should exist in the "gradereport-grader-table" table:
|
||||
| | | |
|
||||
| First name / Surname | Assignment 1 | Course total |
|
||||
@@ -41,7 +40,6 @@ Feature: Regrading grades does not unnecessarily mark some as overriden
|
||||
And I turn editing mode on
|
||||
And I give the grade "80.00" to the user "Student 2" for the grade item "Course total"
|
||||
And I press "Save changes"
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
And I click on "Edit" "link" in the ".coursecategory" "css_element"
|
||||
And I click on "Edit settings" "link" in the ".coursecategory" "css_element"
|
||||
@@ -66,8 +64,7 @@ Feature: Regrading grades does not unnecessarily mark some as overriden
|
||||
And I press "OK"
|
||||
And I set the field "Grade out of 100" to "70"
|
||||
And I press "Save changes"
|
||||
When I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
When I am on the "Course 1" "grades > Grader report > View" page
|
||||
Then the following should exist in the "gradereport-grader-table" table:
|
||||
| | | |
|
||||
| First name / Surname | Assignment 1 | Course total |
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@core @core_grades
|
||||
@core @core_grades @javascript
|
||||
Feature: Control the aggregation of the scales
|
||||
In order to use control the aggregation of the scales
|
||||
As an admin
|
||||
@@ -34,12 +34,9 @@ Feature: Control the aggregation of the scales
|
||||
| Scale me | C1 | Letterscale |
|
||||
And the following config values are set as admin:
|
||||
| grade_includescalesinaggregation | 0 |
|
||||
And I log out
|
||||
|
||||
Scenario Outline: Scales can be excluded from aggregation
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
Given I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
|
||||
And I turn editing mode on
|
||||
When I give the grade "10" to the user "Student 1" for the grade item "Grade me"
|
||||
And I give the grade "B" to the user "Student 1" for the grade item "Scale me"
|
||||
@@ -57,10 +54,7 @@ Feature: Control the aggregation of the scales
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| grade_includescalesinaggregation | 1 |
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > User report" in the course gradebook
|
||||
And I am on the "Course 1" "grades > User report > View" page logged in as "teacher1"
|
||||
And I select "Student 1" from the "Select all or one user" singleselect
|
||||
And the following should exist in the "user-grade" table:
|
||||
| Grade item | Grade | Percentage | Contribution to course total |
|
||||
@@ -80,11 +74,8 @@ Feature: Control the aggregation of the scales
|
||||
| Highest grade | Highest grade. | 10.00 | 10.00 % | 10.00 | 0.00 | 75.00 | 75.00 % | 0.00 % | 75.00 % |
|
||||
| Mode of grades | Mode of grades. | 10.00 | 10.00 % | 10.00 | 0.00 | 75.00 | 75.00 % | 0.00 % | 75.00 % |
|
||||
|
||||
@javascript
|
||||
Scenario: Weights of scales cannot be edited when they are not aggregated
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
Given I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
|
||||
And I turn editing mode on
|
||||
When I set the following settings for grade item "Course 1":
|
||||
| Aggregation | Natural |
|
||||
|
||||
@@ -48,9 +48,7 @@ Feature: View gradebook when single item scales are used
|
||||
And I click on "Grade" "link" in the "Student 1" "table_row"
|
||||
And I set the field "Grade" to "A"
|
||||
And I press "Save changes"
|
||||
And I press "OK"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Course grade settings" in the course gradebook
|
||||
When I am on the "Course 1" "grades > course grade settings" page
|
||||
And I set the field "Show weightings" to "Show"
|
||||
And I set the field "Show contribution to course total" to "Show"
|
||||
And I press "Save changes"
|
||||
|
||||
@@ -47,10 +47,7 @@ Feature: We can enter in grades and view reports from the gradebook
|
||||
| Online text | This is a submission for assignment 2 |
|
||||
And I press "Save changes"
|
||||
Then I should see "Submitted for grading"
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
|
||||
And I turn editing mode on
|
||||
And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment name 1"
|
||||
And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment name 2"
|
||||
|
||||
@@ -343,7 +343,11 @@ class helper {
|
||||
$core = $factory->get_core();
|
||||
|
||||
// When there is a logged in user, her information will be passed to the player. It will be used for tracking.
|
||||
$usersettings = isloggedin() ? ['name' => $USER->username, 'mail' => $USER->email] : [];
|
||||
$usersettings = [];
|
||||
if (isloggedin()) {
|
||||
$usersettings['name'] = fullname($USER, has_capability('moodle/site:viewfullnames', $systemcontext));
|
||||
$usersettings['mail'] = $USER->email;
|
||||
}
|
||||
$settings = array(
|
||||
'baseUrl' => $basepath,
|
||||
'url' => "{$basepath}pluginfile.php/{$systemcontext->instanceid}/core_h5p",
|
||||
|
||||
@@ -452,6 +452,7 @@ $string['customusermenuitems'] = 'User menu items';
|
||||
$string['datarootsecurityerror'] = '<p><strong>SECURITY WARNING!</strong></p><p>Your dataroot directory is in the wrong location and is exposed to the web. This means that all your private files are available to anyone in the world, and some of them could be used by a cracker to obtain unauthorised administrative access to your site!</p>
|
||||
<p>You <em>must</em> move dataroot directory ({$a}) to a new location that is not within your public web directory, and update the <code>$CFG->dataroot</code> setting in your config.php accordingly.</p>';
|
||||
$string['datarootsecuritywarning'] = 'Your site configuration might not be secure. Please make sure that your dataroot directory ({$a}) is not directly accessible via web.';
|
||||
$string['dbprefixtoolong'] = 'Your site\'s database prefix ($CFG->prefix) is too long ({$a->current} characters). The maximum number of characters allowed is {$a->maximum}.';
|
||||
$string['dbsessions'] = 'Use database for session information';
|
||||
$string['debug'] = 'Debug messages';
|
||||
$string['debugall'] = 'ALL: Show all reasonable PHP debug messages';
|
||||
|
||||
@@ -965,9 +965,38 @@ class manager {
|
||||
$command = "{$phpbinary} {$scriptpath} {$taskarg}";
|
||||
|
||||
// Execute it.
|
||||
passthru($command);
|
||||
self::passthru_via_mtrace($command);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This behaves similar to passthru but filters every line via
|
||||
* the mtrace function so it can be post processed.
|
||||
*
|
||||
* @param string $command to run
|
||||
* @return void
|
||||
*/
|
||||
public static function passthru_via_mtrace(string $command) {
|
||||
$descriptorspec = [
|
||||
0 => ['pipe', 'r'], // STDIN.
|
||||
1 => ['pipe', 'w'], // STDOUT.
|
||||
2 => ['pipe', 'w'], // STDERR.
|
||||
];
|
||||
flush();
|
||||
$process = proc_open($command, $descriptorspec, $pipes, realpath('./'), []);
|
||||
if (is_resource($process)) {
|
||||
while ($s = fgets($pipes[1])) {
|
||||
mtrace($s, '');
|
||||
flush();
|
||||
}
|
||||
}
|
||||
|
||||
fclose($pipes[0]);
|
||||
fclose($pipes[1]);
|
||||
fclose($pipes[2]);
|
||||
proc_close($process);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -205,3 +205,57 @@ function min_get_slash_argument($clean = true) {
|
||||
}
|
||||
return $relativepath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the lowest possible currently valid revision number.
|
||||
*
|
||||
* This is based on the current Moodle version.
|
||||
*
|
||||
* @return int Unix timestamp
|
||||
*/
|
||||
function min_get_minimum_revision(): int {
|
||||
static $timestamp = null;
|
||||
|
||||
if ($timestamp === null) {
|
||||
global $CFG;
|
||||
require("{$CFG->dirroot}/version.php");
|
||||
// Get YYYYMMDD from version.
|
||||
$datestring = floor($version / 100);
|
||||
// Parse the date components.
|
||||
$year = intval(substr($datestring, 0, 4));
|
||||
$month = intval(substr($datestring, 4, 2));
|
||||
$day = intval(substr($datestring, 6, 2));
|
||||
// Return converted GMT Unix timestamp.
|
||||
$timestamp = gmmktime(0, 0, 0, $month, $day, $year);
|
||||
}
|
||||
|
||||
return $timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the highest possible currently valid revision number.
|
||||
*
|
||||
* This is based on the current time, allowing for a small amount of clock skew between servers.
|
||||
*
|
||||
* Future values beyond the clock skew are not allowed to avoid the possibility of cache poisoning.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function min_get_maximum_revision(): int {
|
||||
return time() + 60;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to determine if the given revision number is valid.
|
||||
*
|
||||
* @param int $revision A numeric revision to check for validity
|
||||
* @return bool Whether the revision is valid
|
||||
*/
|
||||
function min_is_revision_valid_and_current(int $revision): bool {
|
||||
// Invalid revision.
|
||||
if ($revision <= 0) {
|
||||
return false;
|
||||
}
|
||||
// Check revision is within range.
|
||||
return $revision >= min_get_minimum_revision() && $revision <= min_get_maximum_revision();
|
||||
}
|
||||
|
||||
+13
-1
@@ -1740,9 +1740,11 @@ function enrol_get_course_by_user_enrolment_id($ueid) {
|
||||
* @param bool $onlyactive consider only active enrolments in enabled plugins and time restrictions
|
||||
* @param array $usersfilter Limit the results obtained to this list of user ids. $uefilter compatibility not guaranteed.
|
||||
* @param array $uefilter Limit the results obtained to this list of user enrolment ids. $usersfilter compatibility not guaranteed.
|
||||
* @param array $usergroups Limit the results of users to the ones that belong to one of the submitted group ids.
|
||||
* @return stdClass[]
|
||||
*/
|
||||
function enrol_get_course_users($courseid = false, $onlyactive = false, $usersfilter = array(), $uefilter = array()) {
|
||||
function enrol_get_course_users($courseid = false, $onlyactive = false, $usersfilter = [], $uefilter = [],
|
||||
$usergroups = []) {
|
||||
global $DB;
|
||||
|
||||
if (!$courseid && !$usersfilter && !$uefilter) {
|
||||
@@ -1785,6 +1787,16 @@ function enrol_get_course_users($courseid = false, $onlyactive = false, $usersfi
|
||||
$params = $params + $ueparams;
|
||||
}
|
||||
|
||||
// Only select enrolled users that belong to a specific group(s).
|
||||
if (!empty($usergroups)) {
|
||||
$usergroups = array_map(function ($item) { // Sanitize groupid to int to be save for sql.
|
||||
return (int)$item;
|
||||
}, $usergroups);
|
||||
list($ugsql, $ugparams) = $DB->get_in_or_equal($usergroups, SQL_PARAMS_NAMED);
|
||||
$conditions[] = 'ue.userid IN (SELECT userid FROM {groups_members} WHERE groupid ' . $ugsql . ')';
|
||||
$params = $params + $ugparams;
|
||||
}
|
||||
|
||||
return $DB->get_records_sql($sql . ' ' . implode(' AND ', $conditions), $params);
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -228,8 +228,10 @@ class filter_manager {
|
||||
public function filter_text($text, $context, array $options = array(),
|
||||
array $skipfilters = null) {
|
||||
$text = $this->apply_filter_chain($text, $this->get_text_filters($context), $options, $skipfilters);
|
||||
// Remove <nolink> tags for XHTML compatibility.
|
||||
$text = str_replace(array('<nolink>', '</nolink>'), '', $text);
|
||||
if (!isset($options['stage']) || $options['stage'] === 'post_clean') {
|
||||
// Remove <nolink> tags for XHTML compatibility after the last filtering stage.
|
||||
$text = str_replace(array('<nolink>', '</nolink>'), '', $text);
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -47,6 +47,11 @@ if ($slashargument = min_get_slash_argument()) {
|
||||
$file = min_optional_param('jsfile', '', 'RAW'); // 'file' would collide with URL rewriting!
|
||||
}
|
||||
|
||||
if (!min_is_revision_valid_and_current($rev)) {
|
||||
// If the rev is invalid, normalise it to -1 to disable all caching.
|
||||
$rev = -1;
|
||||
}
|
||||
|
||||
// some security first - pick only files with .js extension in dirroot
|
||||
$jsfiles = array();
|
||||
$files = explode(',', $file);
|
||||
@@ -79,8 +84,7 @@ if (!$jsfiles) {
|
||||
|
||||
$etag = sha1($rev.implode(',', $jsfiles));
|
||||
|
||||
// Use the caching only for meaningful revision numbers which prevents future cache poisoning.
|
||||
if ($rev > 0 and $rev < (time() + 60*60)) {
|
||||
if ($rev > 0) {
|
||||
$candidate = $CFG->localcachedir.'/js/'.$etag;
|
||||
|
||||
if (file_exists($candidate)) {
|
||||
|
||||
+16
-35
@@ -10335,52 +10335,33 @@ function get_course_display_name_for_list($course) {
|
||||
* Safe analogue of unserialize() that can only parse arrays
|
||||
*
|
||||
* Arrays may contain only integers or strings as both keys and values. Nested arrays are allowed.
|
||||
* Note: If any string (key or value) has semicolon (;) as part of the string parsing will fail.
|
||||
* This is a simple method to substitute unnecessary unserialize() in code and not intended to cover all possible cases.
|
||||
*
|
||||
* @param string $expression
|
||||
* @return array|bool either parsed array or false if parsing was impossible.
|
||||
*/
|
||||
function unserialize_array($expression) {
|
||||
$subs = [];
|
||||
// Find nested arrays, parse them and store in $subs , substitute with special string.
|
||||
while (preg_match('/([\^;\}])(a:\d+:\{[^\{\}]*\})/', $expression, $matches) && strlen($matches[2]) < strlen($expression)) {
|
||||
$key = '--SUB' . count($subs) . '--';
|
||||
$subs[$key] = unserialize_array($matches[2]);
|
||||
if ($subs[$key] === false) {
|
||||
return false;
|
||||
}
|
||||
$expression = str_replace($matches[2], $key . ';', $expression);
|
||||
}
|
||||
|
||||
// Check the expression is an array.
|
||||
if (!preg_match('/^a:(\d+):\{([^\}]*)\}$/', $expression, $matches1)) {
|
||||
if (!preg_match('/^a:(\d+):/', $expression)) {
|
||||
return false;
|
||||
}
|
||||
// Get the size and elements of an array (key;value;key;value;....).
|
||||
$parts = explode(';', $matches1[2]);
|
||||
$size = intval($matches1[1]);
|
||||
if (count($parts) < $size * 2 + 1) {
|
||||
return false;
|
||||
}
|
||||
// Analyze each part and make sure it is an integer or string or a substitute.
|
||||
$value = [];
|
||||
for ($i = 0; $i < $size * 2; $i++) {
|
||||
if (preg_match('/^i:(\d+)$/', $parts[$i], $matches2)) {
|
||||
$parts[$i] = (int)$matches2[1];
|
||||
} else if (preg_match('/^s:(\d+):"(.*)"$/', $parts[$i], $matches3) && strlen($matches3[2]) == (int)$matches3[1]) {
|
||||
$parts[$i] = $matches3[2];
|
||||
} else if (preg_match('/^--SUB\d+--$/', $parts[$i])) {
|
||||
$parts[$i] = $subs[$parts[$i]];
|
||||
} else {
|
||||
return false;
|
||||
|
||||
$values = (array) unserialize_object($expression);
|
||||
|
||||
// Callback that returns true if the given value is an unserialized object, executes recursively.
|
||||
$invalidvaluecallback = static function($value) use (&$invalidvaluecallback): bool {
|
||||
if (is_array($value)) {
|
||||
return (bool) array_filter($value, $invalidvaluecallback);
|
||||
}
|
||||
return ($value instanceof stdClass) || ($value instanceof __PHP_Incomplete_Class);
|
||||
};
|
||||
|
||||
// Iterate over the result to ensure there are no stray objects.
|
||||
if (array_filter($values, $invalidvaluecallback)) {
|
||||
return false;
|
||||
}
|
||||
// Combine keys and values.
|
||||
for ($i = 0; $i < $size * 2; $i += 2) {
|
||||
$value[$parts[$i]] = $parts[$i+1];
|
||||
}
|
||||
return $value;
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -643,20 +643,19 @@ abstract class testing_util {
|
||||
$borkedmysql = false;
|
||||
if ($DB->get_dbfamily() === 'mysql') {
|
||||
$version = $DB->get_server_info();
|
||||
if (version_compare($version['version'], '5.6.0') == 1 and version_compare($version['version'], '5.6.16') == -1) {
|
||||
// Everything that comes from Oracle is evil!
|
||||
//
|
||||
// See http://dev.mysql.com/doc/refman/5.6/en/alter-table.html
|
||||
// You cannot reset the counter to a value less than or equal to to the value that is currently in use.
|
||||
//
|
||||
// From 5.6.16 release notes:
|
||||
// InnoDB: The ALTER TABLE INPLACE algorithm would fail to decrease the auto-increment value.
|
||||
// (Bug #17250787, Bug #69882)
|
||||
// Everything that comes from Oracle is evil!
|
||||
//
|
||||
// See http://dev.mysql.com/doc/refman/5.6/en/alter-table.html
|
||||
// You cannot reset the counter to a value less than or equal to to the value that is currently in use.
|
||||
//
|
||||
// From 5.6.16 release notes:
|
||||
// InnoDB: The ALTER TABLE INPLACE algorithm would fail to decrease the auto-increment value.
|
||||
// (Bug #17250787, Bug #69882)
|
||||
if (version_compare($version['version'], '5.6.0', '>=') && version_compare($version['version'], '5.6.16', '<')) {
|
||||
$borkedmysql = true;
|
||||
}
|
||||
|
||||
} else if (version_compare($version['version'], '10.0.0') == 1) {
|
||||
// And MariaDB is no better!
|
||||
// Let's hope they pick the patch sometime later...
|
||||
if (version_compare($version['version'], '5.7.0', '>=') && version_compare($version['version'], '5.7.4', '<')) {
|
||||
$borkedmysql = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace core\testing;
|
||||
|
||||
/**
|
||||
* Testing util tests.
|
||||
*
|
||||
* @package core
|
||||
* @category phpunit
|
||||
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class util_test extends \advanced_testcase {
|
||||
/**
|
||||
* Note: This test is required for the other two parts because the first time
|
||||
* a table is written to it may not have had the initial value reset.
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
public function test_increment_reset_part_one(): void {
|
||||
global $DB;
|
||||
|
||||
switch ($DB->get_dbfamily()) {
|
||||
case 'mssql':
|
||||
$this->markTestSkipped('MSSQL does not support sequences');
|
||||
return;
|
||||
case 'mysql':
|
||||
$version = $DB->get_server_info();
|
||||
if (version_compare($version['version'], '5.7.4', '<')) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$this->resetAfterTest();
|
||||
$DB->insert_record('config_plugins', [
|
||||
'plugin' => 'example',
|
||||
'name' => 'test_increment',
|
||||
'value' => 0,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @coversNothing
|
||||
* @depends test_increment_reset_part_one
|
||||
*/
|
||||
public function test_increment_reset_part_two(): int {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
return $DB->insert_record('config_plugins', [
|
||||
'plugin' => 'example',
|
||||
'name' => 'test_increment',
|
||||
'value' => 0,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends test_increment_reset_part_two
|
||||
*/
|
||||
public function test_increment_reset_part_three(int $previousid): void {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest();
|
||||
$id = $DB->insert_record('config_plugins', [
|
||||
'plugin' => 'example',
|
||||
'name' => 'test_increment',
|
||||
'value' => 0,
|
||||
]);
|
||||
$this->assertEquals($previousid, $id);
|
||||
}
|
||||
}
|
||||
@@ -2188,4 +2188,37 @@ EOF;
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the page title contains a given string.
|
||||
*
|
||||
* @Given the page title should contain ":title"
|
||||
* @param string $title The string that should be present on the page title.
|
||||
*/
|
||||
public function the_page_title_should_contain(string $title): void {
|
||||
$session = $this->getSession();
|
||||
if ($this->running_javascript()) {
|
||||
// When running on JS, the page title can be changed via JS, so it's more reliable to get the actual page title via JS.
|
||||
$actualtitle = $session->evaluateScript("return document.title");
|
||||
} else {
|
||||
$titleelement = $session->getPage()->find('css', 'head title');
|
||||
if ($titleelement === null) {
|
||||
// Throw an exception if a page title is not present on the page.
|
||||
throw new ElementNotFoundException(
|
||||
$this->getSession(),
|
||||
'<title> element',
|
||||
'css',
|
||||
'head title'
|
||||
);
|
||||
}
|
||||
$actualtitle = $titleelement->getText();
|
||||
}
|
||||
|
||||
if (strpos($actualtitle, $title) === false) {
|
||||
throw new ExpectationException(
|
||||
"'$title' was not found from the current page title '$actualtitle'",
|
||||
$session
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -762,7 +762,7 @@ class core_component_testcase extends advanced_testcase {
|
||||
'separators' => ['\\'],
|
||||
'result' => $CFG->dirroot . "/test/src/Multiple/Namespaces.php",
|
||||
],
|
||||
'Getting a file with multiple namespaces' => [
|
||||
'Getting a file with multiple namespaces (non-existent)' => [
|
||||
'classname' => 'Nonexistant\\Namespace\\Test',
|
||||
'prefix' => "Test",
|
||||
'path' => 'test/src',
|
||||
|
||||
@@ -28,7 +28,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
// Global $CFG not used here intentionally to make sure it is not required inside the lib.
|
||||
require_once(__DIR__ . '/../configonlylib.php');
|
||||
|
||||
|
||||
/**
|
||||
* Unit tests for config only library functions.
|
||||
*
|
||||
@@ -151,4 +150,76 @@ class core_configonlylib_testcase extends advanced_testcase {
|
||||
// Windows dir separators are removed, multiple ... gets collapsed to one .
|
||||
$this->assertSame('/standardcore/./5/u/f1', min_get_slash_argument());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the min_get_minimum_version function.
|
||||
*
|
||||
* @covers ::min_get_minimum_version
|
||||
*/
|
||||
public function test_min_get_minimum_version(): void {
|
||||
// This is fairly hard to write a test for, but we can at least check that it returns a number
|
||||
// greater than the version when the feature was first introduced.
|
||||
$firstintroduced = 1592179200; // Equivalent to 20200615 00:00:00 GMT.
|
||||
$this->assertGreaterThanOrEqual($firstintroduced, min_get_minimum_revision());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the min_get_maximum_version function.
|
||||
*
|
||||
* @covers ::min_get_maximum_version
|
||||
*/
|
||||
public function test_min_get_maximum_version(): void {
|
||||
// The maximum version should be set to a time in the near future.
|
||||
// This is currently defined as "in the next minute".
|
||||
// Note: We use a 65 second window to allow for slow test runners.
|
||||
$this->assertGreaterThan(time(), min_get_maximum_revision());
|
||||
$this->assertLessThanOrEqual(time() + 65, min_get_maximum_revision());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the min_is_revision_valid_and_current function.
|
||||
*
|
||||
* @covers ::min_is_revision_valid_and_current
|
||||
* @dataProvider min_is_revision_valid_and_current_provider
|
||||
*/
|
||||
public function test_min_is_revision_valid_and_current(int $revision, bool $expected): void {
|
||||
$this->assertEquals($expected, min_is_revision_valid_and_current($revision));
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for the min_is_revision_valid_and_current tests.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function min_is_revision_valid_and_current_provider(): array {
|
||||
return [
|
||||
'Negative value' => [-1, false],
|
||||
'Empty value' => [0, false],
|
||||
'A time before the minimum accepted value' => [min_get_minimum_revision() - 1, false],
|
||||
'The minimum accepted value' => [min_get_minimum_revision(), true],
|
||||
'The current time' => [time(), true],
|
||||
// Note: We have to be careful using time values because the data provider is run at the start of the phpunit run,
|
||||
// but the test may not be run for some time.
|
||||
// On a slower machine and/or database, this could be several hours.
|
||||
// For a more specific time we must have a specific test function.
|
||||
'A time in the future' => [time() + DAYSECS, false]
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test the min_is_revision_valid_and_current function with close times.
|
||||
*
|
||||
* Note: These tests are incompatible with data providers.
|
||||
*
|
||||
* @covers ::min_is_revision_valid_and_current
|
||||
*/
|
||||
public function test_min_is_revision_valid_and_current_close_proximity(): void {
|
||||
// A time in the near future.
|
||||
$this->assertTrue(min_is_revision_valid_and_current(time() + 55));
|
||||
|
||||
// A time in the too-far future.
|
||||
$this->assertFalse(min_is_revision_valid_and_current(time() + 70));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4384,24 +4384,26 @@ class core_moodlelib_testcase extends advanced_testcase {
|
||||
public function test_unserialize_array() {
|
||||
$a = [1, 2, 3];
|
||||
$this->assertEquals($a, unserialize_array(serialize($a)));
|
||||
$this->assertEquals($a, unserialize_array(serialize($a)));
|
||||
$a = ['a' => 1, 2 => 2, 'b' => 'cde'];
|
||||
$this->assertEquals($a, unserialize_array(serialize($a)));
|
||||
$this->assertEquals($a, unserialize_array(serialize($a)));
|
||||
$a = ['a' => 1, 2 => 2, 'b' => 'c"d"e'];
|
||||
$this->assertEquals($a, unserialize_array(serialize($a)));
|
||||
$a = ['a' => 1, 2 => ['c' => 'd', 'e' => 'f'], 'b' => 'cde'];
|
||||
$this->assertEquals($a, unserialize_array(serialize($a)));
|
||||
|
||||
// Can not unserialize if any string contains semicolons.
|
||||
$a = ['a' => 1, 2 => ['c' => 'd', 'e' => ['f' => 'g']], 'b' => 'cde'];
|
||||
$this->assertEquals($a, unserialize_array(serialize($a)));
|
||||
$a = ['a' => 1, 2 => 2, 'b' => 'c"d";e'];
|
||||
$this->assertEquals(false, unserialize_array(serialize($a)));
|
||||
$this->assertEquals($a, unserialize_array(serialize($a)));
|
||||
|
||||
// Can not unserialize if there are any objects.
|
||||
$a = (object)['a' => 1, 2 => 2, 'b' => 'cde'];
|
||||
$this->assertEquals(false, unserialize_array(serialize($a)));
|
||||
$this->assertFalse(unserialize_array(serialize($a)));
|
||||
$a = ['a' => 1, 2 => 2, 'b' => (object)['a' => 'cde']];
|
||||
$this->assertEquals(false, unserialize_array(serialize($a)));
|
||||
$this->assertFalse(unserialize_array(serialize($a)));
|
||||
$a = ['a' => 1, 2 => 2, 'b' => ['c' => (object)['a' => 'cde']]];
|
||||
$this->assertFalse(unserialize_array(serialize($a)));
|
||||
$a = ['a' => 1, 2 => 2, 'b' => ['c' => new lang_string('no')]];
|
||||
$this->assertFalse(unserialize_array(serialize($a)));
|
||||
|
||||
// Array used in the grader report.
|
||||
$a = array('aggregatesonly' => [51, 34], 'gradesonly' => [21, 45, 78]);
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
/**
|
||||
* Unit tests for format_text defined in weblib.php.
|
||||
*
|
||||
* @covers ::format_text
|
||||
*
|
||||
* @package core
|
||||
* @category test
|
||||
* @copyright 2015 The Open University
|
||||
@@ -96,6 +98,42 @@ class core_weblib_format_text_testcase extends advanced_testcase {
|
||||
format_text('<p>:-)</p>', FORMAT_MOODLE, array('filter' => false)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure that nolink tags and spans prevent linking in filters that support it.
|
||||
*/
|
||||
public function test_format_text_nolink() {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
filter_set_global_state('activitynames', TEXTFILTER_ON);
|
||||
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$context = \context_course::instance($course->id);
|
||||
$page = $this->getDataGenerator()->create_module('page',
|
||||
['course' => $course->id, 'name' => 'Test 1']);
|
||||
$cm = get_coursemodule_from_instance('page', $page->id, $page->course, false, MUST_EXIST);
|
||||
$pageurl = $CFG->wwwroot. '/mod/page/view.php?id=' . $cm->id;
|
||||
|
||||
$this->assertSame(
|
||||
'<p>Read <a class="autolink" title="Test 1" href="' . $pageurl . '">Test 1</a>.</p>',
|
||||
format_text('<p>Read Test 1.</p>', FORMAT_HTML, ['context' => $context]));
|
||||
|
||||
$this->assertSame(
|
||||
'<p>Read <a class="autolink" title="Test 1" href="' . $pageurl . '">Test 1</a>.</p>',
|
||||
format_text('<p>Read Test 1.</p>', FORMAT_HTML, ['context' => $context, 'noclean' => true]));
|
||||
|
||||
$this->assertSame(
|
||||
'<p>Read Test 1.</p>',
|
||||
format_text('<p><nolink>Read Test 1.</nolink></p>', FORMAT_HTML, ['context' => $context, 'noclean' => false]));
|
||||
|
||||
$this->assertSame(
|
||||
'<p>Read Test 1.</p>',
|
||||
format_text('<p><nolink>Read Test 1.</nolink></p>', FORMAT_HTML, ['context' => $context, 'noclean' => true]));
|
||||
|
||||
$this->assertSame(
|
||||
'<p><span class="nolink">Read Test 1.</span></p>',
|
||||
format_text('<p><span class="nolink">Read Test 1.</span></p>', FORMAT_HTML, ['context' => $context]));
|
||||
}
|
||||
|
||||
public function test_format_text_overflowdiv() {
|
||||
$this->assertEquals('<div class="no-overflow"><p>Hello world</p></div>',
|
||||
format_text('<p>Hello world</p>', FORMAT_HTML, array('overflowdiv' => true)));
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
This files describes API changes in core libraries and APIs,
|
||||
information provided here is intended especially for developers.
|
||||
|
||||
=== 3.9.25 ===
|
||||
* In enrollib.php, the method enrol_get_course_users() got an optional 5th parameter $usergroups that
|
||||
defaults to an empty array. Here, user group ids can be provided, to select enrolled users in a course
|
||||
that are also members of these groups.
|
||||
|
||||
=== 3.9.24 ===
|
||||
* New Behat step \behat_general::the_page_title_should_contain() has been added to allow checking of page titles. You can use this
|
||||
when writing feature files to check that the page title contains the expected string.
|
||||
e.g. `And the page title should contain "Some title"`
|
||||
|
||||
===3.9.22===
|
||||
* Added a new parameter in address_in_subnet to give us the ability to check for 0.0.0.0 or not.
|
||||
|
||||
|
||||
@@ -2475,6 +2475,26 @@ function check_igbinary322_version(environment_results $result) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function checks that the database prefix ($CFG->prefix) is <= 10
|
||||
*
|
||||
* @param environment_results $result
|
||||
* @return environment_results|null updated results object, or null if the prefix check is passing ok.
|
||||
*/
|
||||
function check_db_prefix_length(environment_results $result) {
|
||||
global $CFG;
|
||||
|
||||
$prefixlen = strlen($CFG->prefix) ?? 0;
|
||||
if ($prefixlen > 10) {
|
||||
$parameters = (object)['current' => $prefixlen, 'maximum' => 10];
|
||||
$result->setFeedbackStr(['dbprefixtoolong', 'admin', $parameters]);
|
||||
$result->setInfo('db prefix too long');
|
||||
$result->setStatus(false);
|
||||
return $result;
|
||||
}
|
||||
return null; // All, good. By returning null we hide the check.
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert the upgrade key is provided, if it is defined.
|
||||
*
|
||||
|
||||
@@ -4111,7 +4111,7 @@ class core_message_external extends external_api {
|
||||
return new external_function_parameters(
|
||||
array(
|
||||
'userid' => new external_value(PARAM_INT, 'id of the user, 0 for current user', VALUE_REQUIRED),
|
||||
'name' => new external_value(PARAM_TEXT, 'The name of the message processor'),
|
||||
'name' => new external_value(PARAM_SAFEDIR, 'The name of the message processor'),
|
||||
'formvalues' => new external_multiple_structure(
|
||||
new external_single_structure(
|
||||
array(
|
||||
@@ -4187,7 +4187,7 @@ class core_message_external extends external_api {
|
||||
return new external_function_parameters(
|
||||
array(
|
||||
'userid' => new external_value(PARAM_INT, 'id of the user, 0 for current user'),
|
||||
'name' => new external_value(PARAM_TEXT, 'The name of the message processor', VALUE_REQUIRED),
|
||||
'name' => new external_value(PARAM_SAFEDIR, 'The name of the message processor', VALUE_REQUIRED),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
+2
-2
@@ -681,8 +681,8 @@ function message_output_fragment_processor_settings($args = []) {
|
||||
throw new moodle_exception('Must provide a userid');
|
||||
}
|
||||
|
||||
$type = $args['type'];
|
||||
$userid = $args['userid'];
|
||||
$type = clean_param($args['type'], PARAM_SAFEDIR);
|
||||
$userid = clean_param($args['userid'], PARAM_INT);
|
||||
|
||||
$user = core_user::get_user($userid, '*', MUST_EXIST);
|
||||
if (!core_message_can_edit_message_profile($user)) {
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
@mod @mod_assign
|
||||
Feature: Teacher can enable anonymous submissions for an assignment
|
||||
In order to make an anonymous submission to an assignment
|
||||
As a teacher
|
||||
I should be able to enable anonymous submissions
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | One | teacher1@example.com |
|
||||
| student1 | Student | One | student1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following "activities" exist:
|
||||
| activity | course | name | assignsubmission_onlinetext_enabled | blindmarking |
|
||||
| assign | C1 | Assign 1 | 1 | 1 |
|
||||
|
||||
@javascript
|
||||
Scenario: Teacher can enable anonymous submissions
|
||||
# Submit an assignment as student1
|
||||
Given the following "mod_assign > submissions" exist:
|
||||
| assign | user | onlinetext |
|
||||
| Assign 1 | student1 | I'm the student's first submission |
|
||||
When I am on the "Assign 1" "assign activity editing" page logged in as teacher1
|
||||
# Confirm that anonymous submissions can't be changed to no anymore
|
||||
Then "blindmarking" "select" should not exist
|
||||
And I press "Cancel"
|
||||
And I am on the "Assign 1" "assign activity" page
|
||||
And I navigate to "View all submissions" in current page administration
|
||||
# Confirm that Participant [n] is displayed instead of Student One - student name is hidden
|
||||
And I should not see "Student One" in the "Participant" "table_row"
|
||||
And I click on "Grade" "link" in the "Participant" "table_row"
|
||||
And I set the field "Grade out of 100" to "70"
|
||||
And I press "Save changes"
|
||||
And I am on the "Assign 1" "assign activity" page
|
||||
And I navigate to "View all submissions" in current page administration
|
||||
And I select "Reveal student identities" from the "Grading action" singleselect
|
||||
And I should see "Are you sure you want to reveal student identities for this assignment? This operation cannot be undone. Once the student identities have been revealed, the marks will be released to the gradebook."
|
||||
And I press "Continue"
|
||||
# Confirm that student identity is no longer hidden and grade is retained
|
||||
And I should not see "Participant" in the "Student One" "table_row"
|
||||
And I should see "70.00" in the "Student One" "table_row"
|
||||
@@ -20,22 +20,13 @@ Feature: Outcome grading
|
||||
| student1 | C1 | student |
|
||||
And the following config values are set as admin:
|
||||
| enableoutcomes | 1 |
|
||||
And I log in as "admin"
|
||||
And I navigate to "Grades > Scales" in site administration
|
||||
And I press "Add a new scale"
|
||||
And I set the following fields to these values:
|
||||
| Name | Test Scale |
|
||||
| Scale | Disappointing, Excellent, Good, Very good, Excellent |
|
||||
And I press "Save changes"
|
||||
And I navigate to "Grades > Outcomes" in site administration
|
||||
And I press "Add a new outcome"
|
||||
And I set the following fields to these values:
|
||||
| Full name | Outcome Test |
|
||||
| Short name | OT |
|
||||
| Scale | Test Scale |
|
||||
And I press "Save changes"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Outcomes" in current page administration
|
||||
And the following "scales" exist:
|
||||
| name | scale |
|
||||
| Test Scale | Disappointing, Excellent, Good, Very good, Excellent |
|
||||
And the following "grade outcomes" exist:
|
||||
| fullname | shortname | scale |
|
||||
| Outcome Test | OT | Test Scale |
|
||||
And I am on the "Course 1" "grades > outcomes" page logged in as admin
|
||||
And I set the field "Available standard outcomes" to "Outcome Test"
|
||||
And I click on "#add" "css_element"
|
||||
And I log out
|
||||
@@ -49,13 +40,11 @@ Feature: Outcome grading
|
||||
| Description | Test assignment description |
|
||||
| assignsubmission_onlinetext_enabled | 1 |
|
||||
| Outcome Test | 1 |
|
||||
And I log out
|
||||
And I am on the "Test assignment name" "assign activity" page logged in as student1
|
||||
And I press "Add submission"
|
||||
And I set the following fields to these values:
|
||||
| Online text | My online text |
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
When I am on the "Test assignment name" "assign activity" page logged in as teacher1
|
||||
And I navigate to "View all submissions" in current page administration
|
||||
And I click on "Grade" "link" in the "Student 0" "table_row"
|
||||
|
||||
@@ -21,14 +21,14 @@ Feature: In an assignment, page titles are informative
|
||||
|
||||
Scenario: I view an assignment as a student and take an action
|
||||
When I am on the "History of ants" Activity page logged in as student1
|
||||
Then "title[text() = 'C1: History of ants']" "xpath_element" should exist in the "head" "css_element"
|
||||
Then the page title should contain "C1: History of ants"
|
||||
And I press "Add submission"
|
||||
And "title[text() = 'C1: History of ants - Edit submission']" "xpath_element" should exist in the "head" "css_element"
|
||||
And the page title should contain "C1: History of ants - Edit submission"
|
||||
|
||||
Scenario: I view an assignment as a teacher and take an action
|
||||
When I am on the "History of ants" Activity page logged in as teacher1
|
||||
Then "title[text() = 'C1: History of ants']" "xpath_element" should exist in the "head" "css_element"
|
||||
Then the page title should contain "C1: History of ants"
|
||||
And I navigate to "View all submissions" in current page administration
|
||||
And "title[text() = 'C1: History of ants - Grading']" "xpath_element" should exist in the "head" "css_element"
|
||||
And the page title should contain "C1: History of ants - Grading"
|
||||
And I click on "Grade" "link" in the "Student 1" "table_row"
|
||||
And "title[text() = 'C1: History of ants - Grading']" "xpath_element" should exist in the "head" "css_element"
|
||||
And the page title should contain "C1: History of ants - Grading"
|
||||
|
||||
@@ -53,9 +53,7 @@ Feature: In an assignment, teachers grade multiple students on one page
|
||||
| student2 | C1 | student |
|
||||
And the following config values are set as admin:
|
||||
| enableoutcomes | 1 |
|
||||
When I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Outcomes" in current page administration
|
||||
When I am on the "Course 1" "grades > outcomes" page logged in as teacher1
|
||||
And I follow "Edit outcomes"
|
||||
And I press "Add a new outcome"
|
||||
And I follow "Add a new scale"
|
||||
@@ -63,8 +61,7 @@ Feature: In an assignment, teachers grade multiple students on one page
|
||||
| Name | 1337dom scale |
|
||||
| Scale | Noob, Nub, 1337, HaXor |
|
||||
And I press "Save changes"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Outcomes" in current page administration
|
||||
And I am on the "Course 1" "grades > outcomes" page
|
||||
And I follow "Edit outcomes"
|
||||
And I press "Add a new outcome"
|
||||
And I set the following fields to these values:
|
||||
@@ -79,26 +76,17 @@ Feature: In an assignment, teachers grade multiple students on one page
|
||||
| assignsubmission_onlinetext_enabled | 1 |
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
| M8d skillZ! | 1 |
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I am on the "Test assignment name" "assign activity" page logged in as student1
|
||||
And I press "Add submission"
|
||||
And I set the following fields to these values:
|
||||
| Online text | I'm the student1 submission |
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I am on the "Test assignment name" "assign activity" page logged in as student2
|
||||
When I press "Add submission"
|
||||
And I set the following fields to these values:
|
||||
| Online text | I'm the student2 submission |
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I am on the "Test assignment name" "assign activity" page logged in as teacher1
|
||||
And I navigate to "View all submissions" in current page administration
|
||||
And I click on "Grade" "link" in the "Student 1" "table_row"
|
||||
And I set the following fields to these values:
|
||||
@@ -115,28 +103,19 @@ Feature: In an assignment, teachers grade multiple students on one page
|
||||
And I press "Save all quick grading changes"
|
||||
And I should see "The grade changes were saved"
|
||||
And I press "Continue"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I am on the "Test assignment name" "assign activity" page logged in as student1
|
||||
And I should see "I'm the teacher first feedback"
|
||||
And I should see "60.0"
|
||||
And I follow "Grades" in the user menu
|
||||
And I click on "Course 1" "link" in the "region-main" "region"
|
||||
And I should see "1337"
|
||||
And I log out
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I am on the "Test assignment name" "assign activity" page logged in as student2
|
||||
And I should not see "I'm the teacher first feedback"
|
||||
And I should not see "60.0"
|
||||
And I follow "Grades" in the user menu
|
||||
And I click on "Course 1" "link" in the "region-main" "region"
|
||||
And I should not see "1337"
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I am on the "Test assignment name" "assign activity" page logged in as teacher1
|
||||
And I navigate to "View all submissions" in current page administration
|
||||
And I click on "Hide User picture" "link"
|
||||
And I click on "Hide Full name" "link"
|
||||
@@ -154,19 +133,13 @@ Feature: In an assignment, teachers grade multiple students on one page
|
||||
And I press "Save all quick grading changes"
|
||||
And I should see "The grade changes were saved"
|
||||
And I press "Continue"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I am on the "Test assignment name" "assign activity" page logged in as student1
|
||||
And I should see "I'm the teacher first feedback"
|
||||
And I should see "60.0"
|
||||
And I follow "Grades" in the user menu
|
||||
And I click on "Course 1" "link" in the "region-main" "region"
|
||||
And I should see "1337"
|
||||
And I log out
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I am on the "Test assignment name" "assign activity" page logged in as student2
|
||||
And I should not see "I'm the teacher first feedback"
|
||||
And I should not see "60.0"
|
||||
And I follow "Grades" in the user menu
|
||||
|
||||
@@ -69,10 +69,7 @@ Feature: Assignments correctly add feedback to the grade report when workflow an
|
||||
And I should see "Released" in the "I'm the student's first submission" "table_row"
|
||||
And I set the field "Grading action" to "Reveal student identities"
|
||||
And I press "Continue"
|
||||
And I log out
|
||||
|
||||
And I am on the "C1" Course page logged in as student1
|
||||
And I navigate to "User report" in the course gradebook
|
||||
And I am on the "Course 1" "grades > User report > View" page logged in as "student1"
|
||||
Then I should see "50"
|
||||
And I should see "Great job! Lol, not really."
|
||||
|
||||
@@ -97,10 +94,7 @@ Feature: Assignments correctly add feedback to the grade report when workflow an
|
||||
And I follow "Test assignment name"
|
||||
And I navigate to "View all submissions" in current page administration
|
||||
And I should see "Released" in the "Student 1" "table_row"
|
||||
And I log out
|
||||
|
||||
And I am on the "C1" Course page logged in as student1
|
||||
And I navigate to "User report" in the course gradebook
|
||||
And I am on the "Course 1" "grades > User report > View" page logged in as "student1"
|
||||
Then I should see "50"
|
||||
And I should see "Great job! Lol, not really."
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
@mod @mod_data
|
||||
Feature: Students can view upcoming data activities in the timeline block
|
||||
In order for student to see upcoming data activities in timeline block
|
||||
As a teacher
|
||||
I should be able to set the availability dates of data activities
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | One | student1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
|
||||
@javascript
|
||||
Scenario Outline: Student can view upcoming data activities in the timeline block
|
||||
Given the following "activities" exist:
|
||||
| activity | course | name | id_timeavailablefrom_enabled | timeavailablefrom | id_timeavailableto_enabled | timeavailableto |
|
||||
| data | C1 | DB Past | 1 | <pastfrom> | 1 | <pastto> |
|
||||
| data | C1 | DB Future | 1 | <futurefrom> | 1 | <futureto> |
|
||||
| data | C1 | DB No date | 0 | | 0 | |
|
||||
# Confirm that student can see future but not past db activity in the timeline block
|
||||
When I log in as "student 1"
|
||||
Then I should not see "DB Past" in the "Timeline" "block"
|
||||
# Also confirm that student can't see db activity where availability is disabled
|
||||
And I should not see "DB No Date" in the "Timeline" "block"
|
||||
And I should see "DB Future" in the "Timeline" "block"
|
||||
# Confirm link works and redirects to db activity
|
||||
And I click on "DB Future" "link" in the "Timeline" "block"
|
||||
And I should see "Sorry, this activity is not available until"
|
||||
And I should see "<futurefrom>%A, %d %B %Y, %I:%M##"
|
||||
|
||||
Examples:
|
||||
| pastfrom | pastto | futurefrom | futureto |
|
||||
| ##1 month ago## | ##yesterday## | ##tomorrow## | ##tomorrow +1day## |
|
||||
| ##yesterday## | ##yesterday +3hours## | ##tomorrow noon## | ##tomorrow noon +3hours## |
|
||||
| ##6 months ago## | ##1 week ago## | ##tomorrow +5days## | ##tomorrow +6days## |
|
||||
@@ -347,7 +347,7 @@ class discussion_list extends db_table_vault {
|
||||
$favouritesort .= ", {$favalias}.itemtype DESC";
|
||||
}
|
||||
|
||||
return "{$alias}.pinned DESC $favouritesort , {$keyfield} {$direction}";
|
||||
return "{$alias}.pinned DESC $favouritesort , {$keyfield} {$direction}, {$alias}.id {$direction}";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -187,6 +187,10 @@ echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($pagetitle);
|
||||
|
||||
// It is possible that the following fields have been provided in the URL.
|
||||
$userids = array_filter($userids, static function(int $userid) use ($course, $cm): bool {
|
||||
$user = core_user::get_user($userid, '*', MUST_EXIST);
|
||||
return $cm->effectivegroupmode != SEPARATEGROUPS || user_can_view_profile($user, $course);
|
||||
});
|
||||
$form->set_data(['useridsselected' => $userids, 'discussionids' => $discussionids, 'from' => $from, 'to' => $to]);
|
||||
|
||||
$form->display();
|
||||
|
||||
@@ -547,8 +547,8 @@ class summary_table extends table_sql {
|
||||
$userfieldssql = \user_picture::fields('u', $userfields);
|
||||
|
||||
// Define base SQL query format.
|
||||
$this->sql->basefields = ' ue.userid AS userid,
|
||||
e.courseid AS courseid,
|
||||
$this->sql->basefields = ' u.id AS userid,
|
||||
d.course AS courseid,
|
||||
SUM(CASE WHEN p.parent = 0 THEN 1 ELSE 0 END) AS postcount,
|
||||
SUM(CASE WHEN p.parent != 0 THEN 1 ELSE 0 END) AS replycount,
|
||||
' . $userfieldssql . ',
|
||||
@@ -567,13 +567,30 @@ class summary_table extends table_sql {
|
||||
$privaterepliesparams['privatereplyfrom'] = $USER->id;
|
||||
}
|
||||
|
||||
$this->sql->basefromjoins = ' {enrol} e
|
||||
JOIN {user_enrolments} ue ON ue.enrolid = e.id
|
||||
JOIN {user} u ON u.id = ue.userid
|
||||
JOIN {forum} f ON f.course = e.courseid
|
||||
if ($this->iscoursereport) {
|
||||
$course = get_course($this->courseid);
|
||||
$groupmode = groups_get_course_groupmode($course);
|
||||
} else {
|
||||
$cm = \cm_info::create($this->cms[0]);
|
||||
$groupmode = $cm->effectivegroupmode;
|
||||
}
|
||||
|
||||
if ($groupmode == SEPARATEGROUPS && !has_capability('moodle/site:accessallgroups', $this->get_context())) {
|
||||
$groups = groups_get_all_groups($this->courseid, $USER->id, 0, 'g.id');
|
||||
$groupids = array_column($groups, 'id');
|
||||
} else {
|
||||
$groupids = [];
|
||||
}
|
||||
|
||||
[$enrolleduserssql, $enrolledusersparams] = get_enrolled_sql($this->get_context(), '', $groupids);
|
||||
$this->sql->params += $enrolledusersparams;
|
||||
|
||||
$this->sql->basefromjoins = ' {user} u
|
||||
JOIN (' . $enrolleduserssql . ') enrolledusers ON enrolledusers.id = u.id
|
||||
JOIN {forum} f ON f.course = :forumcourseid
|
||||
JOIN {forum_discussions} d ON d.forum = f.id
|
||||
LEFT JOIN {forum_posts} p ON p.discussion = d.id
|
||||
AND p.userid = ue.userid
|
||||
AND p.userid = u.id
|
||||
' . $privaterepliessql
|
||||
. $this->sql->filterbase['dates'] . '
|
||||
LEFT JOIN (
|
||||
@@ -583,11 +600,11 @@ class summary_table extends table_sql {
|
||||
AND fi.filesize > 0
|
||||
GROUP BY fi.itemid, fi.userid
|
||||
) att ON att.postid = p.id
|
||||
AND att.userid = ue.userid';
|
||||
AND att.userid = u.id';
|
||||
|
||||
$this->sql->basewhere = 'e.courseid = :courseid';
|
||||
$this->sql->basewhere = '1=1';
|
||||
|
||||
$this->sql->basegroupby = 'ue.userid, e.courseid, u.id, ' . $userfieldssql;
|
||||
$this->sql->basegroupby = $userfieldssql . ', d.course';
|
||||
|
||||
if ($this->logreader) {
|
||||
$this->fill_log_summary_temp_table();
|
||||
@@ -605,12 +622,12 @@ class summary_table extends table_sql {
|
||||
|
||||
$this->sql->params += [
|
||||
'component' => 'mod_forum',
|
||||
'courseid' => $this->courseid,
|
||||
'forumcourseid' => $this->courseid,
|
||||
] + $privaterepliesparams;
|
||||
|
||||
// Handle if a user is limited to viewing their own summary.
|
||||
if (!empty($this->userid)) {
|
||||
$this->sql->basewhere .= ' AND ue.userid = :userid';
|
||||
$this->sql->basewhere .= ' AND u.id = :userid';
|
||||
$this->sql->params['userid'] = $this->userid;
|
||||
}
|
||||
}
|
||||
@@ -723,7 +740,7 @@ class summary_table extends table_sql {
|
||||
$orderby = " ORDER BY {$sort}";
|
||||
}
|
||||
} else {
|
||||
$selectfields = 'COUNT(DISTINCT(ue.userid))';
|
||||
$selectfields = 'COUNT(u.id)';
|
||||
}
|
||||
|
||||
$sql = "SELECT {$selectfields}
|
||||
|
||||
@@ -11,8 +11,8 @@ Feature: The forum search allows users to perform advanced searches for forum po
|
||||
| teacher2 | Teacher | TWO | teacher2@example.com | T1 |
|
||||
| student1 | Student | 1 | student1@example.com | S1 |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
| fullname | shortname | category | newsitems |
|
||||
| Course 1 | C1 | 0 | 1 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
@@ -24,17 +24,10 @@ Feature: The forum search allows users to perform advanced searches for forum po
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| news_items | Course | C1 | course-view-* | side-pre |
|
||||
And I am on the "Course 1" "course editing" page logged in as teacher1
|
||||
And I expand all fieldsets
|
||||
And I set the field "id_newsitems" to "1"
|
||||
And I press "Save and display"
|
||||
And I add a new topic to "Announcements" forum with:
|
||||
| Subject | My subject |
|
||||
| Message | My message |
|
||||
And I am on "Course 1" course homepage
|
||||
And I add a new topic to "Announcements" forum with:
|
||||
| Subject | Your subjective|
|
||||
| Message | Your long message |
|
||||
And the following "mod_forum > discussions" exist:
|
||||
| user | forum | name | subject | message |
|
||||
| teacher1 | Announcements | My subject | My subject | My message |
|
||||
| teacher1 | Announcements | Your subjective | Your subjective | Your long message |
|
||||
|
||||
Scenario: Perform an advanced search using any term
|
||||
Given I am on the "Announcements" "forum activity" page logged in as student1
|
||||
@@ -77,14 +70,11 @@ Feature: The forum search allows users to perform advanced searches for forum po
|
||||
And I should see "Your subjective"
|
||||
|
||||
Scenario: Perform an advanced search matching the author
|
||||
Given I log in as "teacher2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I add a new topic to "Announcements" forum with:
|
||||
| Subject | My Subjects |
|
||||
| Message | My message |
|
||||
And I log out
|
||||
When I am on the "Announcements" "forum activity" page logged in as student1
|
||||
And I press "Search forums"
|
||||
Given the following "mod_forum > discussions" exist:
|
||||
| user | forum | name | subject | message |
|
||||
| teacher2 | Announcements | My Subjects | My Subjects | My message |
|
||||
And I am on the "Announcements" "forum activity" page logged in as student1
|
||||
When I press "Search forums"
|
||||
And I should see "Advanced search"
|
||||
And I set the field "user" to "TWO"
|
||||
And I press "Search forums"
|
||||
|
||||
@@ -51,6 +51,11 @@ Feature: A user can navigate to previous and next discussions
|
||||
And I follow "Reply"
|
||||
And I set the following fields to these values:
|
||||
| Message | Answer to discussion |
|
||||
# We need to wait a bit to guarantee that the post is created after the previous ones.
|
||||
# because there is a bug in the forum_get_discussion_neighbours() when all the discussion
|
||||
# last modified times are the same. See MDL-79247 for more details. Once that bug is fixed
|
||||
# we can remove this wait.
|
||||
And I wait "1" seconds
|
||||
And I press "Post to forum"
|
||||
And I should not see "Discussion 2"
|
||||
And I should see "Discussion 3"
|
||||
|
||||
@@ -47,19 +47,13 @@ class behat_mod_forum_generator extends behat_generator_base {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the forum id using an activity idnumber.
|
||||
* Get the forum id using an activity idnumber or name.
|
||||
*
|
||||
* @param string $idnumber
|
||||
* @param string $idnumberorname The forum activity idnumber or name.
|
||||
* @return int The forum id
|
||||
*/
|
||||
protected function get_forum_id(string $idnumber): int {
|
||||
global $DB;
|
||||
|
||||
if (!$id = $DB->get_field('course_modules', 'instance', ['idnumber' => $idnumber])) {
|
||||
throw new Exception('The specified activity with idnumber "' . $idnumber . '" could not be found.');
|
||||
}
|
||||
|
||||
return $id;
|
||||
protected function get_forum_id(string $idnumberorname): int {
|
||||
return $this->get_cm_by_activity_name('forum', $idnumberorname)->instance;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user