Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
phpunit_message_sink Class Reference

Message sink. More...

Public Member Functions

 add_message ($message)
 To be called from phpunit_util only!
 
 clear ()
 Removes all previously stored messages.
 
 close ()
 Stop message redirection.
 
 count ()
 Return number of messages redirected to this sink.
 
 get_messages (?callable $filter=null)
 Returns all redirected messages.
 
 get_messages_by_component (string $component)
 Return all redirected messages for a given component.
 
 get_messages_by_component_and_type (string $component, string $type,)
 Return all redirected messages for a given component and type.
 

Protected Attributes

array $messages = array()
 of records from messages table
 

Detailed Description

Message sink.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ add_message()

phpunit_message_sink::add_message ( $message)

To be called from phpunit_util only!

Parameters
stdClass$messagerecord from messages table

◆ close()

phpunit_message_sink::close ( )

Stop message redirection.

Use if you do not want message redirected any more.

◆ count()

phpunit_message_sink::count ( )

Return number of messages redirected to this sink.

Return values
int

◆ get_messages()

phpunit_message_sink::get_messages ( ?callable $filter = null)

Returns all redirected messages.

The instances are records from the messages table. The array indexes are numbered from 0 and the order is matching the creation of events.

Parameters
callable | null$filterUse to filter the messages.
Return values
array

◆ get_messages_by_component()

phpunit_message_sink::get_messages_by_component ( string $component)

Return all redirected messages for a given component.

Parameters
string$componentComponent name.
Return values
arrayList of messages.

◆ get_messages_by_component_and_type()

phpunit_message_sink::get_messages_by_component_and_type ( string $component,
string $type )

Return all redirected messages for a given component and type.

Parameters
string$componentComponent name.
string$typeMessage type.
Return values
arrayList of messages.

The documentation for this class was generated from the following file: