MDL-63387 course: use renamed role names, update Behat tests.
Specify that we want both role names (renamed course role plus original).
This commit is contained in:
@@ -49,7 +49,7 @@ class award_criteria_manual extends award_criteria {
|
||||
$rec = $DB->get_record('role', array('id' => $rid));
|
||||
|
||||
if ($rec) {
|
||||
return role_get_name($rec, $PAGE->context, ROLENAME_ALIAS);
|
||||
return role_get_name($rec, $PAGE->context, ROLENAME_BOTH);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ if ($switchrole > 0 && has_capability('moodle/role:switchroles', $context)) {
|
||||
$roles[0] = get_string('switchrolereturn');
|
||||
$assumedrole = $USER->access['rsw'][$context->path];
|
||||
}
|
||||
$availableroles = get_switchable_roles($context);
|
||||
$availableroles = get_switchable_roles($context, ROLENAME_BOTH);
|
||||
if (is_array($availableroles)) {
|
||||
foreach ($availableroles as $key => $role) {
|
||||
if ($assumedrole == (int)$key) {
|
||||
|
||||
@@ -32,9 +32,15 @@ Feature: Rename roles within a course
|
||||
And I navigate to course participants
|
||||
And I set the field "type" in the "Filter 1" "fieldset" to "Roles"
|
||||
And I click on ".form-autocomplete-downarrow" "css_element" in the "Filter 1" "fieldset"
|
||||
And I should see "Tutor" in the ".form-autocomplete-suggestions" "css_element"
|
||||
And I should see "Learner" in the ".form-autocomplete-suggestions" "css_element"
|
||||
And I should not see "Student" in the ".form-autocomplete-suggestions" "css_element"
|
||||
And I should see "Tutor (Non-editing teacher)" in the ".form-autocomplete-suggestions" "css_element"
|
||||
And I should see "Learner (Student)" in the ".form-autocomplete-suggestions" "css_element"
|
||||
And I click on "Student 1's role assignments" "link"
|
||||
And I click on ".form-autocomplete-downarrow" "css_element" in the "Student 1" "table_row"
|
||||
And "Tutor (Non-editing teacher)" "autocomplete_suggestions" should exist
|
||||
And I click on "Cancel" "link"
|
||||
And I press "Enrol users"
|
||||
And the "Assign role" select box should contain "Learner (Student)"
|
||||
And I click on "Cancel" "button" in the "Enrol users" "dialogue"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I set the following fields to these values:
|
||||
|
||||
@@ -26,9 +26,17 @@ Feature: Rename roles in a course
|
||||
| Your word for 'Teacher' | Lecturer |
|
||||
| Your word for 'Student' | Learner |
|
||||
And I press "Save and display"
|
||||
And I navigate to "Users > Enrolled users" in current page administration
|
||||
Then I should see "Lecturer" in the "Teacher 1" "table_row"
|
||||
And I navigate to course participants
|
||||
Then I should see "Lecturer (Teacher)" in the "Teacher 1" "table_row"
|
||||
And I should see "Learner (Student)" in the "Student 1" "table_row"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to course participants
|
||||
And I should see "Lecturer" in the "Teacher 1" "table_row"
|
||||
And I should see "Learner" in the "Student 1" "table_row"
|
||||
And I should not see "Lecturer (Teacher)" in the "Teacher 1" "table_row"
|
||||
And I should not see "Learner (Student)" in the "Student 1" "table_row"
|
||||
|
||||
Scenario: Ability to rename roles can be prevented
|
||||
Given I log in as "admin"
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ $preview = '';
|
||||
$error = '';
|
||||
|
||||
/// Get applicable roles - used in menus etc later on
|
||||
$rolenames = role_fix_names(get_profile_roles($context), $context, ROLENAME_ALIAS, true);
|
||||
$rolenames = role_fix_names(get_profile_roles($context), $context, ROLENAME_BOTH, true);
|
||||
|
||||
/// Create the form
|
||||
$editform = new autogroup_form(null, array('roles' => $rolenames));
|
||||
|
||||
Reference in New Issue
Block a user