Merge branch 'MDL-60799_500' of https://github.com/jonof/moodle into MOODLE_500_STABLE
This commit is contained in:
@@ -1150,7 +1150,7 @@ class tool_uploadcourse_course {
|
||||
|
||||
// Now update values.
|
||||
// Sort out plugin specific fields.
|
||||
$modifiedinstance = $plugin->update_enrol_plugin_data($course->id, $method, $instance);
|
||||
$modifiedinstance = $plugin->update_enrol_plugin_data($course->id, $method, clone $instance);
|
||||
$plugin->update_instance($instance, $modifiedinstance);
|
||||
} else {
|
||||
foreach ($errors as $key => $message) {
|
||||
|
||||
@@ -126,3 +126,19 @@ Feature: An admin can create courses with cohort enrolments using a CSV file
|
||||
And I press "Cancel"
|
||||
And I click on "Edit" "link" in the "Cohort 4" "table_row"
|
||||
And the field "Assign role" matches value "Non-editing teacher"
|
||||
|
||||
@javascript
|
||||
Scenario: Uploading a cohort enrolment method with a non-default role applies only the specified role
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| t1 | Teacher | 1 | s1@example.com |
|
||||
And the following "cohort members" exist:
|
||||
| user | cohort |
|
||||
| t1 | CV4 |
|
||||
And I upload "admin/tool/uploadcourse/tests/fixtures/enrolment_cohort_multiple.csv" file to "File" filemanager
|
||||
And I click on "Preview" "button"
|
||||
And I click on "Upload courses" "button"
|
||||
When I am on the "Course 1" "course" page
|
||||
And I navigate to course participants
|
||||
Then I should see "Non-editing teacher" in the "Teacher 1" "table_row"
|
||||
And I should not see "Student" in the "Teacher 1" "table_row"
|
||||
|
||||
@@ -110,3 +110,26 @@ Feature: Cohort enrolment management
|
||||
And I set the field "groups[]" to "Beta2 cohort (2)"
|
||||
Then the "members" select box should contain "Bianca McAfee (s3@example.com)"
|
||||
And the "members" select box should contain "Abigail Wyatt (s5@example.com)"
|
||||
|
||||
@javascript
|
||||
Scenario: Editing a cohort enrolment method's role should change participants' role
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| s1 | Sandra | Cole | s1@example.com |
|
||||
And the following "cohort members" exist:
|
||||
| user | cohort |
|
||||
| s1 | A1 |
|
||||
When I log in as "teacher001"
|
||||
And I add "Cohort sync" enrolment method in "Course 001" with:
|
||||
| Cohort | Alpha1 |
|
||||
And I should see "Cohort sync (Alpha1 - Student)"
|
||||
And I navigate to course participants
|
||||
And I should see "Student" in the "Sandra Cole" "table_row"
|
||||
And I am on the "Course 001" "enrolment methods" page
|
||||
And I click on "Edit" "link" in the "Alpha1" "table_row"
|
||||
And I set the field "Assign role" to "Non-editing teacher"
|
||||
And I click on "Save" "button"
|
||||
Then I should see "Cohort sync (Alpha1 - Non-editing teacher)"
|
||||
And I navigate to course participants
|
||||
And I should see "Non-editing teacher" in the "Sandra Cole" "table_row"
|
||||
And I should not see "Student" in the "Sandra Cole" "table_row"
|
||||
|
||||
@@ -89,12 +89,6 @@ if ($mform->is_cancelled()) {
|
||||
$reset = ($instance->status != $data->status);
|
||||
}
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
$instance->$key = $value;
|
||||
}
|
||||
|
||||
$instance->timemodified = time();
|
||||
|
||||
$plugin->update_instance($instance, $data);
|
||||
|
||||
if ($reset) {
|
||||
|
||||
Reference in New Issue
Block a user