[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/message/tests/ -> messagelib_test.php (summary)

Test api's in message lib.

Copyright: 2014 Rajesh Taneja <rajesh@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 873 lines (36 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

core_message_messagelib_testcase:: (26 methods):
  setUp()
  send_fake_message()
  test_message_get_blocked_users()
  test_message_get_contacts()
  test_message_count_messages()
  test_message_count_unread_messages()
  test_message_count_blocked_users()
  test_message_add_contact()
  test_message_remove_contact()
  test_message_block_contact()
  test_message_unblock_contact()
  test_message_search_users()
  test_message_search()
  message_get_recent_conversations_provider()
  test_message_get_recent_conversations()
  test_message_get_recent_notifications()
  test_message_can_post_message_returns_false_without_capability()
  test_message_can_post_message_returns_false_non_contact_blocked()
  test_message_can_post_message_returns_false_if_blocked()
  test_message_can_post_message_returns_true()
  test_message_is_user_non_contact_blocked_false_without_preference()
  test_message_is_user_non_contact_blocked_true_with_preference()
  test_message_is_user_non_contact_blocked_false_with_if_contact()
  test_message_is_user_blocked_false_no_contact()
  test_message_is_user_blocked_false_if_readallmessages()
  test_message_is_user_blocked_true_if_blocked()


Class: core_message_messagelib_testcase  - X-Ref

Test api's in message lib.

setUp()   X-Ref
Test set up.

This is executed before running any test in this file.

send_fake_message($userfrom, $userto, $message = 'Hello world!')   X-Ref
Send a fake message.

{@link message_send()} does not support transaction, this function will simulate a message
sent from a user to another. We should stop using it once {@link message_send()} will support
transactions. This is not clean at all, this is just used to add rows to the table.

param: stdClass $userfrom user object of the one sending the message.
param: stdClass $userto user object of the one receiving the message.
param: string $message message to send.
return: int the id of the message

test_message_get_blocked_users()   X-Ref
Test message_get_blocked_users.


test_message_get_contacts()   X-Ref
Test message_get_contacts.


test_message_count_messages()   X-Ref
Test message_count_messages.


test_message_count_unread_messages()   X-Ref
Test message_count_unread_messages.


test_message_count_blocked_users()   X-Ref
Test message_count_blocked_users.


test_message_add_contact()   X-Ref
Test message_add_contact.


test_message_remove_contact()   X-Ref
Test message_remove_contact.


test_message_block_contact()   X-Ref
Test message_block_contact.


test_message_unblock_contact()   X-Ref
Test message_unblock_contact.


test_message_search_users()   X-Ref
Test message_search_users.


test_message_search()   X-Ref
Test message_search.


message_get_recent_conversations_provider()   X-Ref
The data provider for message_get_recent_conversations.

This provides sets of data to for testing.
return: array

test_message_get_recent_conversations($usersdata, $contacts, $messagesdata, $expectations)   X-Ref
Test message_get_recent_conversations with a mixture of messages.

param: array $usersdata The list of users to create for this test.
param: array $messagesdata The list of messages to create.
param: array $expectations The list of expected outcomes.

test_message_get_recent_notifications()   X-Ref
Test message_get_recent_notifications.


test_message_can_post_message_returns_false_without_capability()   X-Ref
Test that message_can_post_message returns false if the sender does not have the
moode/site:sendmessage capability.


test_message_can_post_message_returns_false_non_contact_blocked()   X-Ref
Test that message_can_post_message returns false if the receiver only accepts
messages from contacts and the sender isn't a contact.


test_message_can_post_message_returns_false_if_blocked()   X-Ref
Test that message_can_post_message returns false if the receiver has blocked the
sender from messaging them.


test_message_can_post_message_returns_true()   X-Ref
Test that message_can_post_message returns false if the receiver has blocked the
sender from messaging them.


test_message_is_user_non_contact_blocked_false_without_preference()   X-Ref
Test that message_is_user_non_contact_blocked returns false if the recipient allows
messages from non-contacts.


test_message_is_user_non_contact_blocked_true_with_preference()   X-Ref
Test that message_is_user_non_contact_blocked returns true if the recipient doesn't
allow messages from non-contacts and the sender isn't a contact.


test_message_is_user_non_contact_blocked_false_with_if_contact()   X-Ref
Test that message_is_user_non_contact_blocked returns false if the recipient doesn't
allow messages from non-contacts but the sender is a contact.


test_message_is_user_blocked_false_no_contact()   X-Ref
Test that message_is_user_blocked returns false if the sender is not a contact of
the recipient.


test_message_is_user_blocked_false_if_readallmessages()   X-Ref
Test that message_is_user_blocked returns false if the sender is a contact that is
blocked by the recipient but has the moodle/site:readallmessages capability.


test_message_is_user_blocked_true_if_blocked()   X-Ref
Test that message_is_user_blocked returns true if the sender is a contact that is
blocked by the recipient and does not have the moodle/site:readallmessages capability.




Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1