MDL-59801 users: Behat fixes

Firstly - the list of roles to filter needs to be a combination of the assignable roles and the existing roles in the course.
Secondly - the auto-complete behat step needs to search for entire strings, not substrings.
This commit is contained in:
Damyon Wiese 2017-08-31 12:32:03 +08:00
parent 4bd649d31a
commit d29be32000
2 changed files with 3 additions and 5 deletions

View File

@ -532,7 +532,7 @@ class behat_forms extends behat_base {
* @param string $item
*/
public function i_click_on_item_in_the_autocomplete_list($item) {
$xpathtarget = "//ul[@class='form-autocomplete-suggestions']//*[contains(.,'" . $item . "')]";
$xpathtarget = "//ul[@class='form-autocomplete-suggestions']//*[contains(concat('|', string(.), '|'),'|" . $item . "|')]";
$this->execute('behat_general::i_click_on', [$xpathtarget, 'xpath_element']);

View File

@ -282,11 +282,9 @@ class core_user_renderer extends plugin_renderer_base {
// Filter options for role.
$roleseditable = has_capability('moodle/role:assign', $context);
$roles = [];
$roles = role_fix_names(get_profile_roles($context), $context, ROLENAME_ALIAS, true);
if ($roleseditable) {
$roles = get_assignable_roles($context, ROLENAME_ALIAS);
} else {
$roles = role_fix_names(get_profile_roles($context), $context, ROLENAME_ALIAS, true);
$roles += get_assignable_roles($context, ROLENAME_ALIAS);
}
$criteria = get_string('role');
$roleoptions = [];