MDL-59365 enrol: Behat fixes

Fixes for the new enrol users popup with behat.
This commit is contained in:
Damyon Wiese
2017-07-13 10:55:01 +08:00
parent 002ac8e9fe
commit af6d23853a
4 changed files with 6 additions and 5 deletions
+2 -1
View File
@@ -452,12 +452,13 @@ class core_enrol_external extends external_api {
$params['perpage']);
$results = array();
$requiredfields = ['id', 'fullname', 'profileimageurl', 'profileimageurlsmall'];
foreach ($users['users'] as $id => $user) {
// Note: We pass the course here to validate that the current user can at least view user details in this course.
// The user we are looking at is not in this course yet though - but we only fetch the minimal set of
// user records, and the user has been validated to have course:enrolreview in this course. Otherwise
// there is no way to find users who aren't in the course in order to enrol them.
if ($userdetails = user_get_user_details($user, $course)) {
if ($userdetails = user_get_user_details($user, $course, $requiredfields)) {
$results[] = $userdetails;
}
}
+1 -1
View File
@@ -90,7 +90,7 @@ switch ($action) {
}
}
$roleid = optional_param('role', null, PARAM_INT);
$roleid = optional_param('roletoassign', null, PARAM_INT);
$duration = optional_param('duration', 0, PARAM_FLOAT);
$startdate = optional_param('startdate', 0, PARAM_INT);
$recovergrades = optional_param('recovergrades', 0, PARAM_INT);
+2 -2
View File
@@ -106,10 +106,10 @@ class enrol_manual_enrol_users_form extends moodleform {
$mform->addElement('cohort', 'cohortlist', get_string('selectcohorts', 'enrol_manual'), $options);
$roles = get_assignable_roles($context);
$mform->addElement('select', 'role', get_string('assignrole', 'enrol_manual'), $roles);
$mform->addElement('select', 'roletoassign', get_string('assignrole', 'enrol_manual'), $roles);
$keys = array_keys($roles);
$defaultrole = end($keys);
$mform->setDefault('role', $defaultrole);
$mform->setDefault('roletoassign', $defaultrole);
$mform->addAdvancedStatusElement('main');
+1 -1
View File
@@ -95,7 +95,7 @@ class behat_enrol extends behat_base {
$this->execute("behat_forms::press_button", get_string('enrolusers', 'enrol'));
if ($this->running_javascript()) {
$this->execute('behat_forms::i_set_the_field_to', array(get_string('assignroles', 'enrol_manual'), $rolename));
$this->execute('behat_forms::i_set_the_field_to', array(get_string('assignrole', 'enrol_manual'), $rolename));
// We have a div here, not a tr.
$this->execute('behat_forms::i_set_the_field_to', array(get_string('selectusers', 'enrol_manual'), $userfullname));