Merge "Rename ReferencesFormatter to ReferenceListFormatter"

This commit is contained in:
jenkins-bot 2024-02-07 18:00:04 +00:00 committed by Gerrit Code Review
commit 46499cd9c0
5 changed files with 27 additions and 27 deletions

View file

@ -50,7 +50,7 @@ class Cite {
private bool $isSectionPreview;
private FootnoteMarkFormatter $footnoteMarkFormatter;
private ReferencesFormatter $referencesFormatter;
private ReferenceListFormatter $referenceListFormatter;
private ErrorReporter $errorReporter;
/**
@ -83,7 +83,7 @@ class Cite {
$anchorFormatter,
$messageLocalizer
);
$this->referencesFormatter = new ReferencesFormatter(
$this->referenceListFormatter = new ReferenceListFormatter(
$this->errorReporter,
$anchorFormatter,
$messageLocalizer
@ -306,7 +306,7 @@ class Cite {
): string {
global $wgCiteResponsiveReferences;
return $this->referencesFormatter->formatReferences(
return $this->referenceListFormatter->formatReferences(
$parser,
$this->referenceStack->popGroup( $group ),
$responsive !== null ? $responsive !== '0' : $wgCiteResponsiveReferences,

View file

@ -11,7 +11,7 @@ use Parser;
*
* @license GPL-2.0-or-later
*/
class ReferencesFormatter {
class ReferenceListFormatter {
/**
* The backlinks, in order, to pass as $3 to

View file

@ -4,7 +4,7 @@ namespace Cite\Tests;
use Cite\Cite;
use Cite\ErrorReporter;
use Cite\ReferencesFormatter;
use Cite\ReferenceListFormatter;
use Cite\ReferenceStack;
use Language;
use Parser;
@ -38,15 +38,15 @@ class CiteIntegrationTest extends \MediaWikiIntegrationTestCase {
$referenceStack = new ReferenceStack();
TestingAccessWrapper::newFromObject( $referenceStack )->refs = $initialRefs;
$referencesFormatter = $this->createMock( ReferencesFormatter::class );
$referencesFormatter->method( 'formatReferences' )->willReturn( '<references />' );
$formatter = $this->createMock( ReferenceListFormatter::class );
$formatter->method( 'formatReferences' )->willReturn( '<references />' );
$cite = $this->newCite();
/** @var Cite $spy */
$spy = TestingAccessWrapper::newFromObject( $cite );
$spy->referenceStack = $referenceStack;
$spy->errorReporter = $mockErrorReporter;
$spy->referencesFormatter = $referencesFormatter;
$spy->referenceListFormatter = $formatter;
$spy->isSectionPreview = $isSectionPreview;
$parser = $this->createNoOpMock( Parser::class );

View file

@ -5,7 +5,7 @@ namespace Cite\Tests\Integration;
use Cite\Cite;
use Cite\ErrorReporter;
use Cite\FootnoteMarkFormatter;
use Cite\ReferencesFormatter;
use Cite\ReferenceListFormatter;
use Cite\ReferenceStack;
use Cite\Tests\TestUtils;
use Language;
@ -139,8 +139,8 @@ class CiteTest extends \MediaWikiIntegrationTestCase {
$spy->errorReporter->method( 'halfParsed' )->willReturnCallback(
static fn ( $parser, ...$args ) => '(' . implode( '|', $args ) . ')'
);
$spy->referencesFormatter = $this->createMock( ReferencesFormatter::class );
$spy->referencesFormatter->method( 'formatReferences' )
$spy->referenceListFormatter = $this->createMock( ReferenceListFormatter::class );
$spy->referenceListFormatter->method( 'formatReferences' )
->with( $parser, [], $expectedResponsive, false )
->willReturn( 'references!' );
$spy->isSectionPreview = false;

View file

@ -4,18 +4,18 @@ namespace Cite\Tests\Unit;
use Cite\AnchorFormatter;
use Cite\ErrorReporter;
use Cite\ReferenceListFormatter;
use Cite\ReferenceMessageLocalizer;
use Cite\ReferencesFormatter;
use Cite\Tests\TestUtils;
use Message;
use Parser;
use Wikimedia\TestingAccessWrapper;
/**
* @covers \Cite\ReferencesFormatter
* @covers \Cite\ReferenceListFormatter
* @license GPL-2.0-or-later
*/
class ReferencesFormatterTest extends \MediaWikiUnitTestCase {
class ReferenceListFormatterTest extends \MediaWikiUnitTestCase {
/**
* @dataProvider provideFormatReferences
@ -38,7 +38,7 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase {
}
);
$formatter = new ReferencesFormatter(
$formatter = new ReferenceListFormatter(
$mockErrorReporter,
$this->createMock( AnchorFormatter::class ),
$mockMessageLocalizer
@ -172,8 +172,8 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase {
* @dataProvider provideCloseIndention
*/
public function testCloseIndention( $closingLi, $expectedOutput ) {
/** @var ReferencesFormatter $formatter */
$formatter = TestingAccessWrapper::newFromObject( new ReferencesFormatter(
/** @var ReferenceListFormatter $formatter */
$formatter = TestingAccessWrapper::newFromObject( new ReferenceListFormatter(
$this->createMock( ErrorReporter::class ),
$this->createMock( AnchorFormatter::class ),
$this->createMock( ReferenceMessageLocalizer::class )
@ -220,8 +220,8 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase {
}
);
/** @var ReferencesFormatter $formatter */
$formatter = TestingAccessWrapper::newFromObject( new ReferencesFormatter(
/** @var ReferenceListFormatter $formatter */
$formatter = TestingAccessWrapper::newFromObject( new ReferenceListFormatter(
$mockErrorReporter,
$anchorFormatter,
$mockMessageLocalizer
@ -311,8 +311,8 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase {
static fn ( $parser, ...$args ) => '(' . implode( '|', $args ) . ')'
);
/** @var ReferencesFormatter $formatter */
$formatter = TestingAccessWrapper::newFromObject( new ReferencesFormatter(
/** @var ReferenceListFormatter $formatter */
$formatter = TestingAccessWrapper::newFromObject( new ReferenceListFormatter(
$mockErrorReporter,
$this->createMock( AnchorFormatter::class ),
$this->createMock( ReferenceMessageLocalizer::class )
@ -367,8 +367,8 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase {
$errorReporter->expects( $expectedLabel ? $this->never() : $this->once() )
->method( 'plain' );
/** @var ReferencesFormatter $formatter */
$formatter = TestingAccessWrapper::newFromObject( new ReferencesFormatter(
/** @var ReferenceListFormatter $formatter */
$formatter = TestingAccessWrapper::newFromObject( new ReferenceListFormatter(
$errorReporter,
$this->createMock( AnchorFormatter::class ),
$mockMessageLocalizer
@ -398,8 +398,8 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase {
$mockMessageLocalizer->method( 'localizeSeparators' )->willReturnArgument( 0 );
$mockMessageLocalizer->method( 'localizeDigits' )->willReturnArgument( 0 );
/** @var ReferencesFormatter $formatter */
$formatter = TestingAccessWrapper::newFromObject( new ReferencesFormatter(
/** @var ReferenceListFormatter $formatter */
$formatter = TestingAccessWrapper::newFromObject( new ReferenceListFormatter(
$this->createMock( ErrorReporter::class ),
$this->createMock( AnchorFormatter::class ),
$mockMessageLocalizer
@ -430,8 +430,8 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase {
}
);
/** @var ReferencesFormatter $formatter */
$formatter = TestingAccessWrapper::newFromObject( new ReferencesFormatter(
/** @var ReferenceListFormatter $formatter */
$formatter = TestingAccessWrapper::newFromObject( new ReferenceListFormatter(
$this->createMock( ErrorReporter::class ),
$this->createMock( AnchorFormatter::class ),
$mockMessageLocalizer