Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Class: core_messagelib_testcase  - X-Ref

test_message_provider_disabled()   X-Ref
No description

test_message_get_providers_for_user()   X-Ref
No description

test_message_get_providers_for_user_more()   X-Ref
No description

test_send_message_redirection()   X-Ref
No description

test_send_message()   X-Ref
No description

test_message_send_to_conversation_individual()   X-Ref
Tests calling message_send() with $eventdata representing a message to an individual conversation.

This test will verify:
- that the 'messages' record is created.
- that the processors will be called for each conversation member, except the sender.
- the a single event will be generated - 'message_sent'

Note: We won't redirect/capture messages in this test because doing so causes message_send() to return early, before
processors and events code is called. We need to test this code here, as we generally redirect messages elsewhere and we
need to be sure this is covered.

test_message_send_to_self_conversation()   X-Ref
Tests calling message_send() with $eventdata representing a message to a self-conversation.

This test will verify:
- that the 'messages' record is created.
- that the processors is not called (for now self-conversations are not processed).
- the a single event will be generated - 'message_sent'

Note: We won't redirect/capture messages in this test because doing so causes message_send() to return early, before
processors and events code is called. We need to test this code here, as we generally redirect messages elsewhere and we
need to be sure this is covered.

test_message_send_to_conversation_group()   X-Ref
Tests calling message_send() with $eventdata representing a message to an group conversation.

This test will verify:
- that the 'messages' record is created.
- that the processors will be called for each conversation member, except the sender.
- the a single event will be generated - 'group_message_sent'

Note: We won't redirect/capture messages in this test because doing so causes message_send() to return early, before
processors and events code is called. We need to test this code here, as we generally redirect messages elsewhere and we
need to be sure this is covered.

test_send_message_to_conversation_group_with_buffering()   X-Ref
Verify that sending a message to a conversation is an action which can be buffered by the manager if in a DB transaction.

This should defer all processor calls (for 2 members in this case), and event creation (1 event).

test_rollback()   X-Ref
No description

test_forced_rollback()   X-Ref
No description

test_message_attachment_send()   X-Ref
No description

test_send_message_when_muted()   X-Ref
No description

message_type_present($component, $name, $providers)   X-Ref
Is a particular message type in the list of message types.

param: string $component
param: string $name a message name.
param: array $providers as returned by message_get_providers_for_user.
return: bool whether the message type is present.