MediaWiki  master
MockMessageLocalizer Class Reference

A simple MessageLocalizer implementation for use in tests. More...

Inheritance diagram for MockMessageLocalizer:
Collaboration diagram for MockMessageLocalizer:

Public Member Functions

 __construct ( $languageCode='qqx')
 
 msg ( $key)
 Get a Message object. More...
 

Private Attributes

string null $languageCode
 

Detailed Description

A simple MessageLocalizer implementation for use in tests.

By default, it sets the message language to 'qqx', to make the tests independent of the wiki configuration.

Author
Lucas Werkmeister
Note
GPL-2.0-or-later

Definition at line 11 of file MockMessageLocalizer.php.

Constructor & Destructor Documentation

◆ __construct()

MockMessageLocalizer::__construct (   $languageCode = 'qqx')
Parameters
string | null$languageCodeThe language code to use for messages by default. You can specify null to use the user language, but this is not recommended as it may make your tests depend on the wiki configuration.

Definition at line 23 of file MockMessageLocalizer.php.

References $languageCode.

Member Function Documentation

◆ msg()

MockMessageLocalizer::msg (   $key)

Get a Message object.

Parameters are the same as wfMessage().

Parameters
string|string[]|MessageSpecifier$key Message key, or array of keys, or a MessageSpecifier.
mixed$args,...
Returns
Message

Implements MessageLocalizer.

Definition at line 36 of file MockMessageLocalizer.php.

References $args, null, and wfMessage().

Member Data Documentation

◆ $languageCode

string null MockMessageLocalizer::$languageCode
private

Definition at line 16 of file MockMessageLocalizer.php.

Referenced by __construct().


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