Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Class: events_test  - X-Ref

Class containing the tests for message related events.

setUp()   X-Ref
Test set up.

This is executed before running any test in this file.

test_message_contact_added()   X-Ref
Test the message contact added event.


test_message_contact_removed()   X-Ref
Test the message contact removed event.


test_message_user_blocked()   X-Ref
Test the message user blocked event.


test_message_user_unblocked()   X-Ref
Test the message user unblocked event.


test_message_sent()   X-Ref
Test the message sent event.

We can not use the message_send() function in the unit test to check that the event was fired as there is a
conditional check to ensure a fake message is sent during unit tests when calling that particular function.

test_mesage_sent_without_other_courseid()   X-Ref
No description

test_mesage_sent_via_create_from_ids()   X-Ref
No description

test_group_message_sent()   X-Ref
Test the group message sent event.

We can't test events in any testing of the message_send() function as there is a conditional PHPUNIT check in message_send,
resulting in fake messages being generated and captured under test. As a result, none of the events code, nor message
processor code is called during testing.

test_group_message_sent_without_other_courseid()   X-Ref
Test the group message sent event when created without a courseid.


test_group_message_sent_without_other_conversationid()   X-Ref
Test the group message sent event when created without a conversationid.


test_group_message_sent_via_create_from_ids()   X-Ref
Test the group message sent event using the create_from_ids() method.


test_message_viewed()   X-Ref
Test the message viewed event.


test_message_deleted()   X-Ref
Test the message deleted event.


test_message_deleted_whole_conversation()   X-Ref
Test the message deleted event is fired when deleting a conversation.


test_notification_sent()   X-Ref
Test the notification sent event.


test_notification_sent_with_null_course()   X-Ref
Test the notification sent event when null passed as course.


test_notification_viewed()   X-Ref
Test the notification viewed event.