Skip to content

Commit

Permalink
MDL-73722 course: behat test for other users page
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaglancy authored and paulholden committed Feb 1, 2022
1 parent 91683bf commit 5ddae1a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
31 changes: 31 additions & 0 deletions course/tests/behat/other_users.feature
@@ -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"
8 changes: 8 additions & 0 deletions lib/tests/behat/behat_navigation.php
Expand Up @@ -750,6 +750,7 @@ protected function resolve_core_page_url(string $name): moodle_url {
* | 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:
*
Expand Down Expand Up @@ -861,6 +862,13 @@ protected function resolve_core_page_instance_url(string $type, string $identifi
$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);
Expand Down

0 comments on commit 5ddae1a

Please sign in to comment.