Changes to the use statements done automatically via script Addition of missing use statement done manually Change-Id: I4ff4d0c10820dc2a3b8419b4115fadf81a76f7a2
33 lines
913 B
PHP
33 lines
913 B
PHP
<?php
|
|
|
|
use MediaWiki\Message\Message;
|
|
use MediaWiki\Message\MessageFormatterFactory;
|
|
|
|
/**
|
|
* @covers \MediaWiki\Message\MessageFormatterFactory
|
|
*/
|
|
class MessageFormatterFactoryTest extends MediaWikiUnitTestCase {
|
|
use MediaWikiCoversValidator;
|
|
|
|
public static function provideGetTextFormatter() {
|
|
yield [ 'en', null ];
|
|
yield [ 'en', Message::FORMAT_TEXT ];
|
|
yield [ 'ru', Message::FORMAT_PLAIN ];
|
|
}
|
|
|
|
/**
|
|
* @covers \MediaWiki\Message\MessageFormatterFactory::getTextFormatter
|
|
* @dataProvider provideGetTextFormatter
|
|
* @param string $lang
|
|
* @param string|null $format
|
|
*/
|
|
public function testGetTextFormatter( string $lang, string $format = null ) {
|
|
if ( $format ) {
|
|
$factory = new MessageFormatterFactory( $format );
|
|
} else {
|
|
$factory = new MessageFormatterFactory();
|
|
}
|
|
$formatter = $factory->getTextFormatter( $lang );
|
|
$this->assertSame( $lang, $formatter->getLangCode() );
|
|
}
|
|
}
|