This test requires a course in which self-enrolment is allowed and for which an enrolment key has been set.
1. Login as a teacher, access a course and follow the groups link in the course administration settings.
2. Create a group and set a group enrolment key.
3. Login as user1 (not yet enrolled in the course) and enrol in the course by supplying the course enrolment key.
4. Login as user2 (not yet enrolled in the course) and enrol in the course by supplying the group enrolment key.
5. Login as the teacher again, access the participants page and check that user2 is a member of the group whereas user1 is not.
This test may be run on http://qa.moodle.net/ by creating a group in the Features Demo course then logging in as student6 and student7 (both with password 'test').