wiki.techinc.nl/tests/phpunit/unit/includes/Message/MessageFormatterFactoryTest.php
Umherirrender f27c2433bb tests: Use namespaced classes (2)
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: I4ff4d0c10820dc2a3b8419b4115fadf81a76f7a2
2024-06-13 23:21:02 +02:00

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() );
}
}