Just methods where adding "static" to the declaration was enough, I didn't do anything with providers that used $this. Initially by search and replace. There were many mistakes which I found mostly by running the PHPStorm inspection which searches for $this usage in a static method. Later I used the PHPStorm "make static" action which avoids the more obvious mistakes. Bug: T332865 Change-Id: I47ed6692945607dfa5c139d42edbd934fa4f3a36
32 lines
882 B
PHP
32 lines
882 B
PHP
<?php
|
|
|
|
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() );
|
|
}
|
|
}
|