wiki.techinc.nl/tests/phpunit/unit/includes/language/FormatterFactoryTest.php
daniel 3d55397207 Move creation of BlockErrorFormatter into FormatterFactory
The idea is that all formatters that need the user language or
other request specific context should be instantiated by
FormatterFactory.

Change-Id: I8334cc89dcf0f293298b82e004116be50a90f0d1
2024-01-26 13:03:44 -05:00

45 lines
1.2 KiB
PHP

<?php
use MediaWiki\HookContainer\HookContainer;
use MediaWiki\Language\FormatterFactory;
use MediaWiki\Languages\LanguageFactory;
use MediaWiki\Title\TitleFormatter;
use MediaWiki\User\UserIdentityUtils;
/**
* @covers MediaWiki\Language\FormatterFactory
*/
class FormatterFactoryTest extends MediaWikiUnitTestCase {
private function getFactory() {
return new FormatterFactory(
$this->createNoOpMock( MessageCache::class ),
$this->createNoOpMock( TitleFormatter::class ),
$this->createNoOpMock( HookContainer::class ),
$this->createNoOpMock( UserIdentityUtils::class ),
$this->createNoOpMock( LanguageFactory::class )
);
}
public function testGetStatusFormatter() {
$factory = $this->getFactory();
$factory->getStatusFormatter(
$this->createNoOpMock( MessageLocalizer::class )
);
// Just make sure the getter works.
// This protects against constructor signature changes.
$this->addToAssertionCount( 1 );
}
public function testGetBlockErrorFormatter() {
$factory = $this->getFactory();
$factory->getBlockErrorFormatter(
$this->createNoOpMock( IContextSource::class )
);
// Just make sure the getter works.
// This protects against constructor signature changes.
$this->addToAssertionCount( 1 );
}
}