Make use of createNoOpMock in ReferenceListFormatterTest

The main benefit is that this makes it more obvious what is actually
under test, and what's not.

This is mainly motivated by the ongoing work in Iaca0e14.

Change-Id: Icbf1b824ba1f5468dbdb30445134db2b568e19f8
This commit is contained in:
thiemowmde 2024-08-13 10:41:04 +02:00
parent d847caf5b8
commit 3cebd437e8

View file

@ -174,9 +174,9 @@ class ReferenceListFormatterTest extends \MediaWikiUnitTestCase {
public function testCloseIndention( $closingLi, $expectedOutput ) {
/** @var ReferenceListFormatter $formatter */
$formatter = TestingAccessWrapper::newFromObject( new ReferenceListFormatter(
$this->createMock( ErrorReporter::class ),
$this->createMock( AnchorFormatter::class ),
$this->createMock( ReferenceMessageLocalizer::class )
$this->createNoOpMock( ErrorReporter::class ),
$this->createNoOpMock( AnchorFormatter::class ),
$this->createNoOpMock( ReferenceMessageLocalizer::class )
) );
$output = $formatter->closeIndention( $closingLi );
@ -312,8 +312,8 @@ class ReferenceListFormatterTest extends \MediaWikiUnitTestCase {
/** @var ReferenceListFormatter $formatter */
$formatter = TestingAccessWrapper::newFromObject( new ReferenceListFormatter(
$mockErrorReporter,
$this->createMock( AnchorFormatter::class ),
$this->createMock( ReferenceMessageLocalizer::class )
$this->createNoOpMock( AnchorFormatter::class ),
$this->createNoOpMock( ReferenceMessageLocalizer::class )
) );
$parser = $this->createNoOpMock( Parser::class );
@ -367,7 +367,7 @@ class ReferenceListFormatterTest extends \MediaWikiUnitTestCase {
/** @var ReferenceListFormatter $formatter */
$formatter = TestingAccessWrapper::newFromObject( new ReferenceListFormatter(
$errorReporter,
$this->createMock( AnchorFormatter::class ),
$this->createNoOpMock( AnchorFormatter::class ),
$mockMessageLocalizer
) );
@ -397,8 +397,8 @@ class ReferenceListFormatterTest extends \MediaWikiUnitTestCase {
/** @var ReferenceListFormatter $formatter */
$formatter = TestingAccessWrapper::newFromObject( new ReferenceListFormatter(
$this->createMock( ErrorReporter::class ),
$this->createMock( AnchorFormatter::class ),
$this->createNoOpMock( ErrorReporter::class ),
$this->createNoOpMock( AnchorFormatter::class ),
$mockMessageLocalizer
) );
@ -429,8 +429,8 @@ class ReferenceListFormatterTest extends \MediaWikiUnitTestCase {
/** @var ReferenceListFormatter $formatter */
$formatter = TestingAccessWrapper::newFromObject( new ReferenceListFormatter(
$this->createMock( ErrorReporter::class ),
$this->createMock( AnchorFormatter::class ),
$this->createNoOpMock( ErrorReporter::class ),
$this->createNoOpMock( AnchorFormatter::class ),
$mockMessageLocalizer
) );
$this->assertSame( $expected, $formatter->listToText( $list ) );