From 3cebd437e8a7b19bfc253ba9693a23d6e198e769 Mon Sep 17 00:00:00 2001 From: thiemowmde Date: Tue, 13 Aug 2024 10:41:04 +0200 Subject: [PATCH] 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 --- .../unit/ReferenceListFormatterTest.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/phpunit/unit/ReferenceListFormatterTest.php b/tests/phpunit/unit/ReferenceListFormatterTest.php index 765d88fb2..76e53b610 100644 --- a/tests/phpunit/unit/ReferenceListFormatterTest.php +++ b/tests/phpunit/unit/ReferenceListFormatterTest.php @@ -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 ) );