Reduce unused mocks in CommentFormatterTest

For example, in case nothing is ever called it's sometimes helpful to
use "NoOp" mocks to make this more visible.

There is also no actual OutputPage needed, just the much more narrow
interface.

Change-Id: I44522276726786abd75c85c02a7003c33a5602bb
This commit is contained in:
thiemowmde 2024-06-22 00:16:26 +02:00 committed by Thiemo Kreuz (WMDE)
parent da90f4b049
commit 15a9304bc5

View file

@ -4,7 +4,7 @@ namespace MediaWiki\Extension\DiscussionTools\Tests;
use FormatJson;
use MediaWiki\Cache\GenderCache;
use MediaWiki\Config\Config;
use MediaWiki\Context\IContextSource;
use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
use MediaWiki\Output\OutputPage;
@ -55,7 +55,7 @@ class CommentFormatterTest extends IntegrationTestCase {
string $name, string $titleText, string $dom, string $expected, string $config, string $data,
bool $isMobile, bool $useButtons
): void {
$this->setService( 'GenderCache', $this->createMock( GenderCache::class ) );
$this->setService( 'GenderCache', $this->createNoOpMock( GenderCache::class ) );
$dom = static::getHtml( $dom );
$expectedPath = $expected;
$expected = static::getText( $expectedPath );
@ -77,8 +77,7 @@ class CommentFormatterTest extends IntegrationTestCase {
$qqxLang = MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( 'qqx' );
$skin = $this->createMock( Skin::class );
$skin->method( 'getSkinName' )->willReturn( 'minerva' );
$outputPage = $this->createMock( OutputPage::class );
$outputPage->method( 'getConfig' )->willReturn( $this->createMock( Config::class ) );
$outputPage = $this->createMock( IContextSource::class );
$outputPage->method( 'getTitle' )->willReturn( $title );
$outputPage->method( 'getUser' )->willReturn( $user );
$outputPage->method( 'getLanguage' )->willReturn( $qqxLang );