From b2be6f4ece493a884647166d442a0de85d930f63 Mon Sep 17 00:00:00 2001 From: thiemowmde Date: Mon, 27 Feb 2023 17:36:40 +0100 Subject: [PATCH] Update incomplete ReferencesFormatterTest The mock was incomplete, leaving a feature uncovered. Change-Id: I657728f89c94602a7aa9b3fbfabc53e7fdac348c --- tests/phpunit/unit/ReferencesFormatterTest.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/phpunit/unit/ReferencesFormatterTest.php b/tests/phpunit/unit/ReferencesFormatterTest.php index 37b2bc9bb..cf321cb40 100644 --- a/tests/phpunit/unit/ReferencesFormatterTest.php +++ b/tests/phpunit/unit/ReferencesFormatterTest.php @@ -212,6 +212,7 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase { return implode( '+', $args ); } ); + $anchorFormatter->method( 'getReferencesKey' )->willReturnArgument( 0 ); $mockMessageLocalizer = $this->createMock( ReferenceMessageLocalizer::class ); $mockMessageLocalizer->method( 'localizeSeparators' )->willReturnArgument( 0 ); @@ -246,7 +247,7 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase { [ 'text' => 't', ], - '(cite_references_link_many|||t' . "\n|)" + '(cite_references_link_many|1-||t' . "\n|)" ], 'With dir' => [ 1, @@ -254,7 +255,7 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase { 'dir' => 'rtl', 'text' => 't', ], - '(cite_references_link_many|||t' . + '(cite_references_link_many|1-||t' . "\n" . '| class="mw-cite-dir-rtl")' ], 'Incomplete follow' => [ @@ -263,7 +264,7 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase { 'follow' => 'f', 'text' => 't', ], - '(cite_references_no_link||t' . "\n)" + '(cite_references_no_link|f|t' . "\n)" ], 'Count zero' => [ 1, @@ -272,7 +273,7 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase { 'key' => 5, 'text' => 't', ], - '(cite_references_link_one||1+5-0|t' . "\n|)" + '(cite_references_link_one|1-5|1+5-0|t' . "\n|)" ], 'Count negative' => [ 1, @@ -282,7 +283,7 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase { 'number' => 3, 'text' => 't', ], - '(cite_references_link_one||5+|t' . "\n|)" + '(cite_references_link_one|5|5+|t' . "\n|)" ], 'Count positive' => [ 1, @@ -292,7 +293,7 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase { 'number' => 3, 'text' => 't', ], - '(cite_references_link_many||(cite_references_link_many_format|1+5-0|3.0|' . + '(cite_references_link_many|1-5|(cite_references_link_many_format|1+5-0|3.0|' . '(cite_references_link_many_format_backlink_labels))' . '(cite_references_link_many_sep)(cite_references_link_many_format|1+5-1|3.1|' . '(cite_error_references_no_backlink_label))(cite_references_link_many_and)' .