- This test requires a site where notifications/emails are enabled. For this reason it is not possible to use the QA testing site.
- You can use MailCatcher to verify you receive the event subscription email.
- The test needs a course with a teacher and two students enrolled.
The test site needs to have event monitoring enabled: Site administration > Reports > Event monitoring rules and click Enable link.
- As a teacher go to the course.
- Add a new file resource, upload a file and name it 'Course contract'.
- Go to Course administration > Reports > Event monitoring rules
- Create a new rule setting the fields:
- Rule name: Contract
- Area to monitor: File
- Event: Course module viewed
- Enter any Description, Notification threshold in minutes and you can use the default Notification message template.
- Still as teacher, in the user menu select Preferences > Event monitoring and select the course you have created the rule.
- Subscribe to the rule you created, selecting 'Course contract' from the dropdown.
- Go back to your user preferences page and click Notification preferences and ensure Email is enabled for "Notifications of rule subscriptions" under Event monitor.
- Log in as student1, go to the course and download the file resource.
- Run cron php admin/cli/cron.php in your terminal
- Verify that you receive an email to the teacher's email address:
- The Event name as the email subject.
- Notification message field content should be email body.
- Log in as a teacher and go your user preferences page and then go to Notification preferences.
- Disable email notifications and enable web notifications for "Notifications of rule subscriptions".
- Log in as student2 , go to the course and download the same file resource.
- Run cron again, same command as above.
- Verify you receive a notification in the notification popover (bell icon) in the navigation bar.
- Verify that you do not receive an email for that notification.