-
Functional Test
-
Minor
-
Moodle 4.3
The goal of this test is to ensure that it is possible for Moodle users to enrol in courses on another Moodle site using MNet.
Pre-requisites
- This test needs to be executed on both the minimum and the maximum PHP supported versions for the master branch (for example, for Moodle 4.2dev, PHP 8.0 and PHP 8.1).
Setup
Please note: it's possible that you see some notices during the setup part depending of the debugging levels in your site. You can ignore them as far as the configuration works as expected.
- Setup a couple of Moodle sites:
- site1 running the version to be released (master).
- site2 running older version, for example: Moodle 4.0.x (MOODLE_400_STABLE)
- Ensure that they have different $CFG->sessioncookiepath setting either on config.php or in Administration > Server > Session handling
- In both sites, enable and configure MNet as explained in the doc page.
- For extra information about MNet enrolments, please refer to the documentation page
- Use two different browsers to test this.
- Configuring site1 to be able to apply for enrolments, the one using integration master branch:
- Go to Admin -> Networking -> Manage peers and in the list click on the "site2" link. In the Services tab tick on "Subscribe" the "Remote enrolment service". And ensure that "Publish" is not ticked. Also, confirm that the FOUR SSO settings (IdP and SP publish and subscribe are ticked from previous test).
- This should be set from previous tests, but go to Admin -> Users -> Define roles and ensure that the Authenticated user role has the "moodle/site:mnetlogintoremote" allowed. Allow it if needed to (so we guarantee that all users in "site1" can use MNet SSO/roaming.
- Create a couple of users in "site1".
- With this, "site1" is ready to apply for remote enrolments in "site2".
- Configuring site2 (that will accept remote enrolments, the one using MOODLE_400_STABLE):
- Go to Admin -> Plugins -> Manage enrol plugins and enable "MNet remote enrolments"
- Go to Admin -> Networking -> Manage peers and in the list click on the "site1" link. In the Services tab tick on "Publish" the "Remote enrolment service". And ensure that "Subscribe" is not ticked. Also, confirm that the FOUR SSO settings (IdP and SP publish and subscribe are ticked from previous test).
- Create a couple of courses: Course21 and Course22
- In Course21 -> Participants, select "Enrolment methods" and add the "MNet remote enrolments" method, selecting "site1" in the "Remote host" dropdown. Press "Add method".
- With this, "site2" is ready to accept remote enrolments from "site1".
Testing remote enrolments work as expected ("site1" ==> "site2")
- In site1, go to Admin -> Networking -> Remote enrolments client.
- Verify that you see a table with one entry for site2.
- Click on "Edit enrolments" button.
- If there is a "Re-fetch" button, click on it.
- Verify that in the list of courses from "site2" you see "Course21" but don't see "Course22".
- Go to site2 and in Course22 -> Participants, select "Enrolment methods" and add the "MNet remote enrolments" method, selecting "site1" in the "Remote host" dropdown. Press "Add method".
- Back to "site1" refresh the "Remote enrolments client" page.
- Verify that now both Course21 and Course22 are shown in the list.
- Click the "Edit enrolments" button of Course22.
- Select a couple of users and "Add" them, so they show on the left column.
- In "site2", go to Course22 -> participants
- Verify that the 2 users added from site1 are listed now and displayed as "Active"
- Click on the little "i" (information).
- Verify that you see "MNet remote enrolments (site1)" in the information.
- Back to "site1", remove one of the 2 enrolled users. Annotate it.
- In "site2", refresh the participants page.
- Verify that now only one user is listed and the annotated user in "site1" does not show anymore. Annotate it.
- Back to "site1", verify that the "Network servers" is in front page (from previous tests). Add it if missing.
- Logout from the admin session.
- Login in "site1" as the annotated user (the one remaining from the 2 originally enrolled).
- In the front page, click on the "site2" link in the "Networks servers" block.
- Verify that the user is automatically roamed to "site2" and you see the "Welcome back userxxx" message.
- Go to "My courses".
- Verify that Course22 is shown (that means the user in enrolled).
- Click in the "Course22" link.
- Verify the user access to the course without any problem.
- Logout from "site2".
- Verify that you're automatically redirected back to "site1" (not logged-in).