mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
Merge branch 'MDL-73873-master' of https://github.com/aanabit/moodle
This commit is contained in:
commit
18631ff886
@ -483,9 +483,17 @@ class enrol_cohort_plugin extends enrol_plugin {
|
||||
'customint2' => $validgroups
|
||||
);
|
||||
$typeerrors = $this->validate_param_types($data, $tovalidate);
|
||||
// When creating a new cohort enrolment, we allow multiple cohorts in just one go.
|
||||
// When editing an existing enrolment, changing the cohort is no allowed, so cohort is a single value.
|
||||
if (is_array($data['customint1'])) {
|
||||
$cohorts = $data['customint1'];
|
||||
} else {
|
||||
$cohorts = [$data['customint1']];
|
||||
}
|
||||
|
||||
$errors = array_merge($errors, $typeerrors);
|
||||
// Check that the cohorts passed are valid.
|
||||
if (!empty(array_diff($data['customint1'], $validcohorts))) {
|
||||
if (!empty(array_diff($cohorts, $validcohorts))) {
|
||||
$errors['customint1'] = get_string('invaliddata', 'error');
|
||||
}
|
||||
return $errors;
|
||||
|
@ -1,5 +1,5 @@
|
||||
@enrol @enrol_cohort
|
||||
Feature: Enrol multiple cohorts
|
||||
Feature: Cohort enrolment management
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
@ -30,3 +30,14 @@ Feature: Enrol multiple cohorts
|
||||
And I press "Add method"
|
||||
Then I should see "Cohort sync (Beta2 - Student)"
|
||||
And I should see "Cohort sync (Alpha1 - Student)"
|
||||
|
||||
@javascript
|
||||
Scenario: Edit cohort enrolment
|
||||
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 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"
|
||||
And I should see "Cohort sync (Alpha1 - Non-editing teacher)"
|
||||
|
Loading…
x
Reference in New Issue
Block a user