Search moodle.org's
Developer Documentation

See Release Notes

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

Differences Between: [Versions 310 and 402] [Versions 39 and 402]

Tests for core_message_inbound to test Variable Envelope Return Path functionality.

Copyright: 2014 Andrew Nicols <andrew@nicols.co.uk>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 670 lines (24 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 message/tests/fixtures/inbound_fixtures.php

Defines 3 classes


Class: inbound_test  - X-Ref

Tests for core_message_inbound to test Variable Envelope Return Path functionality.

setUp()   X-Ref
Perform setup tasks generic to each test.
This includes:
* configuring the messageinbound_mailbox.


helper_create_handler($handlerclass, $enabled = true, $component = 'core_test', $namespace = '\\core\\test\\')   X-Ref
Helper to create a new Inbound Message handler.

param: $handlerclass The class of the handler to create
param: $enabled Whether the handler should be enabled
param: $component The component
param: $namepace The namepace

test_is_enabled()   X-Ref
Test that the enabled check perform as expected.


test_address_constraints()   X-Ref
Test that data items conform to RFCs 5231, and 5322 standards for
addressing, and to RFC 5233 for sub-addressing.


test_address_uniqueness()   X-Ref
Test that the generated e-mail addresses are sufficiently random by
testing the multiple handlers, multiple users, and multiple data
items.


test_address_parsing()   X-Ref
Test address parsing of a generated address.


test_address_validation_invalid_format_failure()   X-Ref
Test address parsing of an address with an unrecognised format.


test_address_validation_unknown_handler()   X-Ref
Test address parsing of an address with an unknown handler.


test_address_validation_disabled_handler()   X-Ref
Test address parsing of an address with a disabled handler.


test_address_validation_invalid_user()   X-Ref
Test address parsing of an address for an invalid user.


test_address_validation_disabled_user()   X-Ref
Test address parsing of an address for a disabled user.


test_address_validation_invalid_key()   X-Ref
Test address parsing of an address for an invalid key.


test_address_validation_expired_key()   X-Ref
Test address parsing of an address for an expired key.


test_address_validation_invalid_hash()   X-Ref
Test address parsing of an address for an invalid hash.


test_address_validation_invalid_sender()   X-Ref
Test address parsing of an address for an invalid sender.


test_address_validation_success()   X-Ref
Test address parsing of an address for an address which is correct.


test_default_hander_expiry_unlimited()   X-Ref
Test that a handler with no default expiration does not have an
expiration time applied.


test_default_hander_expiry_low()   X-Ref
Test application of the default expiry on a handler.


test_default_hander_expiry_medium()   X-Ref
Test application of the default expiry on a handler.


Class: core_message_inbound_test_helper  - X-Ref

A helper function for unit testing to expose protected functions in the core_message_inbound API for testing.

validate($address)   X-Ref
The validate function.

param: string $address
return: int

get_data()   X-Ref
The get_data function.

return: stdClass

process($address)   X-Ref
The address processor function.

param: string $address
return: void

Class: core_message_inbound_test_manager  - X-Ref

A helper function for unit testing to expose protected functions in the core_message_inbound API for testing.

handler_from_record($record)   X-Ref
Helper to fetch make the handler_from_record public for unit testing.

param: $record The handler record to fetch