This commit is contained in:
Shamim Rezaie 2022-02-10 17:21:10 +11:00
commit e30493108d
3 changed files with 48 additions and 3 deletions

View File

@ -0,0 +1,31 @@
@core @core_course @javascript
Feature: Test if displaying the course other users works correctly:
As a user I need to see the other users who have permissions in a course without being enrolled.
Background:
Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
And the following "courses" exist:
| fullname | shortname | category | format |
| Course 1 | C1 | CAT1 | topics |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| manager1 | Manager | 1 | manager1@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
Scenario: Test other users list in a course
Given I log in as "admin"
And I am on the "Course 1" "other users" page
And I should see "Course 1: 0 other users"
And the following "role assigns" exist:
| user | role | contextlevel | reference |
| manager1 | manager | System | |
And I am on the "Course 1" "other users" page
And I should see "Course 1: 1 other users"
And I should see "Manager 1"

View File

@ -94,8 +94,14 @@ $PAGE->set_title($course->fullname.': '.get_string('totalotherusers', 'enrol', $
$PAGE->set_heading($PAGE->title);
echo $OUTPUT->header();
$searchbutton = $table->get_user_search_button();
$searchbutton->primary = true;
echo $OUTPUT->render_participants_tertiary_nav($course, $OUTPUT->render($searchbutton));
// Check we have a search button to render.
$searchbuttonrender = null;
if ($searchbutton = $table->get_user_search_button()) {
$searchbutton->primary = true;
$searchbuttonrender = $OUTPUT->render($searchbutton);
}
echo $OUTPUT->render_participants_tertiary_nav($course, $searchbuttonrender);
echo $renderer->render($table);
echo $OUTPUT->footer();

View File

@ -750,6 +750,7 @@ class behat_navigation extends behat_base {
* | Permissions | course shortname | Permissions page for the course |
* | Enrolment methods | course shortname | Enrolment methods for the course |
* | Enrolled users | course shortname | The main participants page |
* | Other users | course shortname | The course other users page |
*
* Examples:
*
@ -869,6 +870,13 @@ class behat_navigation extends behat_base {
$identifier . '" does not exist');
}
return new moodle_url('/user/index.php', ['id' => $courseid]);
case 'other users':
$courseid = $this->get_course_id($identifier);
if (!$courseid) {
throw new Exception('The specified course with shortname, fullname, or idnumber "' .
$identifier . '" does not exist');
}
return new moodle_url('/enrol/otherusers.php', ['id' => $courseid]);
}
$parts = explode(' ', $type);