From 5d1335e279fb5e4b7fe0a575e9b7f9ef82d60543 Mon Sep 17 00:00:00 2001 From: Adam Wight Date: Thu, 21 Dec 2023 20:44:39 +0100 Subject: [PATCH] Explicit parameter names for all test fixtures This is much more readable. Patch changes nothing. Bug: T353451 Change-Id: I72b58881a7329dbe98659553b84e53896ccafc2b --- tests/phpunit/integration/CiteTest.php | 100 ++++++------ tests/phpunit/unit/ErrorReporterTest.php | 12 +- tests/phpunit/unit/ReferenceStackTest.php | 144 +++++++++--------- .../phpunit/unit/ReferencesFormatterTest.php | 84 +++++----- 4 files changed, 169 insertions(+), 171 deletions(-) diff --git a/tests/phpunit/integration/CiteTest.php b/tests/phpunit/integration/CiteTest.php index 027e6ec3d..85f4b1003 100644 --- a/tests/phpunit/integration/CiteTest.php +++ b/tests/phpunit/integration/CiteTest.php @@ -224,13 +224,13 @@ class CiteTest extends \MediaWikiIntegrationTestCase { public static function provideGuardedRef() { return [ 'Whitespace text' => [ - ' ', - [ 'name' => 'a' ], - null, - [], - '', - [], - [ + 'text' => ' ', + 'argv' => [ 'name' => 'a' ], + 'inReferencesGroup' => null, + 'initialRefs' => [], + 'expectedOutput' => '', + 'expectedErrors' => [], + 'expectedRefs' => [ '' => [ 'a' => [ 'count' => 0, @@ -244,39 +244,37 @@ class CiteTest extends \MediaWikiIntegrationTestCase { ] ], 'Empty in default references' => [ - '', - [], - '', - [ '' => [] ], - '', + 'text' => '', + 'argv' => [], + 'inReferencesGroup' => '', + 'initialRefs' => [ '' => [] ], + 'expectedOutput' => '', 'expectedErrors' => [ [ 'cite_error_references_no_key' ] ], - [ '' => [] ] + 'expectedRefs' => [ '' => [] ] ], 'Fallback to references group' => [ - 'text', - [ 'name' => 'a' ], - 'foo', - [ - 'foo' => [ - 'a' => [] - ] + 'text' => 'text', + 'argv' => [ 'name' => 'a' ], + 'inReferencesGroup' => 'foo', + 'initialRefs' => [ + 'foo' => [ 'a' => [] ], ], - '', - [], - [ + 'expectedOutput' => '', + 'expectedErrors' => [], + 'expectedRefs' => [ 'foo' => [ 'a' => [ 'text' => 'text' ], ], ] ], 'Successful ref' => [ - 'text', - [ 'name' => 'a' ], - null, - [], - '', - [], - [ + 'text' => 'text', + 'argv' => [ 'name' => 'a' ], + 'inReferencesGroup' => null, + 'initialRefs' => [], + 'expectedOutput' => '', + 'expectedErrors' => [], + 'expectedRefs' => [ '' => [ 'a' => [ 'count' => 0, @@ -290,29 +288,29 @@ class CiteTest extends \MediaWikiIntegrationTestCase { ] ], 'Invalid ref' => [ - 'text', - [ + 'text' => 'text', + 'argv' => [ 'name' => 'a', 'badkey' => 'b', ], - null, - [], - '(cite_error_ref_too_many_keys)', - [], - [] + 'inReferencesGroup' => null, + 'initialRefs' => [], + 'expectedOutput' => '(cite_error_ref_too_many_keys)', + 'expectedErrors' => [], + 'expectedRefs' => [] ], 'Successful references ref' => [ - 'text', - [ 'name' => 'a' ], - '', - [ + 'text' => 'text', + 'argv' => [ 'name' => 'a' ], + 'inReferencesGroup' => '', + 'initialRefs' => [ '' => [ 'a' => [] ] ], - '', - [], - [ + 'expectedOutput' => '', + 'expectedErrors' => [], + 'expectedRefs' => [ '' => [ 'a' => [ 'text' => 'text' ], ], @@ -333,17 +331,17 @@ class CiteTest extends \MediaWikiIntegrationTestCase { 'isSectionPreview' => true, ], 'Mismatched text in references' => [ - 'text-2', - [ 'name' => 'a' ], - '', - [ + 'text' => 'text-2', + 'argv' => [ 'name' => 'a' ], + 'inReferencesGroup' => '', + 'initialRefs' => [ '' => [ 'a' => [ 'text' => 'text-1' ], ] ], - '', - [], - [ + 'expectedOutput' => '', + 'expectedErrors' => [], + 'expectedRefs' => [ '' => [ 'a' => [ 'text' => 'text-1', diff --git a/tests/phpunit/unit/ErrorReporterTest.php b/tests/phpunit/unit/ErrorReporterTest.php index 32ab597e9..0ee0e53ba 100644 --- a/tests/phpunit/unit/ErrorReporterTest.php +++ b/tests/phpunit/unit/ErrorReporterTest.php @@ -44,16 +44,16 @@ class ErrorReporterTest extends \MediaWikiUnitTestCase { public static function provideErrors() { return [ 'Example error' => [ - 'cite_error_example', - '' . + 'key' => 'cite_error_example', + 'expectedHtml' => '' . '(cite_error|(cite_error_example|first param))', - [ 'cite-tracking-category-cite-error' ] + 'categories' => [ 'cite-tracking-category-cite-error' ] ], 'Warning error' => [ - 'cite_warning_example', - ' 'cite_warning_example', + 'expectedHtml' => '(cite_warning|(cite_warning_example|first param))', - [] + 'categories' => [] ], ]; } diff --git a/tests/phpunit/unit/ReferenceStackTest.php b/tests/phpunit/unit/ReferenceStackTest.php index 768a3a6be..70be7ef32 100644 --- a/tests/phpunit/unit/ReferenceStackTest.php +++ b/tests/phpunit/unit/ReferenceStackTest.php @@ -52,10 +52,10 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { public static function providePushRef() { return [ 'Anonymous ref in default group' => [ - [ + 'refs' => [ [ 'text', [], '', null, null, null, 'rtl' ] ], - [ + 'expectedOutputs' => [ [ 'count' => -1, 'dir' => 'rtl', @@ -65,7 +65,7 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { 'number' => 1, ] ], - [ + 'finalRefs' => [ '' => [ [ 'count' => -1, @@ -77,15 +77,15 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { ] ] ], - [ + 'finalCallStack' => [ [ 'new', 1, '', null, null, 'text', [] ], ] ], 'Anonymous ref in named group' => [ - [ + 'refs' => [ [ 'text', [], 'foo', null, null, null, 'rtl' ] ], - [ + 'expectedOutputs' => [ [ 'count' => -1, 'dir' => 'rtl', @@ -95,7 +95,7 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { 'number' => 1, ] ], - [ + 'finalRefs' => [ 'foo' => [ [ 'count' => -1, @@ -107,15 +107,15 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { ] ] ], - [ + 'finalCallStack' => [ [ 'new', 1, 'foo', null, null, 'text', [] ], ] ], 'Ref with text' => [ - [ + 'refs' => [ [ 'text', [], 'foo', null, null, null, 'rtl' ] ], - [ + 'expectedOutputs' => [ [ 'count' => -1, 'dir' => 'rtl', @@ -125,7 +125,7 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { 'number' => 1, ] ], - [ + 'finalRefs' => [ 'foo' => [ [ 'count' => -1, @@ -137,15 +137,15 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { ] ] ], - [ + 'finalCallStack' => [ [ 'new', 1, 'foo', null, null, 'text', [] ], ] ], 'Named ref with text' => [ - [ + 'refs' => [ [ 'text', [], 'foo', 'name', null, null, 'rtl' ] ], - [ + 'expectedOutputs' => [ [ 'count' => 0, 'dir' => 'rtl', @@ -155,7 +155,7 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { 'number' => 1, ], ], - [ + 'finalRefs' => [ 'foo' => [ 'name' => [ 'count' => 0, @@ -167,16 +167,16 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { ] ] ], - [ + 'finalCallStack' => [ [ 'new', 1, 'foo', 'name', null, 'text', [] ], ] ], 'Follow after base' => [ - [ + 'refs' => [ [ 'text-a', [], 'foo', 'a', null, null, 'rtl' ], [ 'text-b', [], 'foo', 'b', null, 'a', 'rtl' ] ], - [ + 'expectedOutputs' => [ [ 'count' => 0, 'dir' => 'rtl', @@ -187,7 +187,7 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { ], null ], - [ + 'finalRefs' => [ 'foo' => [ 'a' => [ 'count' => 0, @@ -199,18 +199,18 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { ] ] ], - [ + 'finalCallStack' => [ [ 'new', 1, 'foo', 'a', null, 'text-a', [] ], ] ], 'Follow with no base' => [ - [ + 'refs' => [ [ 'text', [], 'foo', null, null, 'a', 'rtl' ] ], - [ + 'expectedOutputs' => [ null ], - [ + 'finalRefs' => [ 'foo' => [ [ 'count' => -1, @@ -222,17 +222,17 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { ] ] ], - [ + 'finalCallStack' => [ [ 'new', 1, 'foo', null, null, 'text', [] ], ] ], 'Follow pointing to later ref' => [ - [ + 'refs' => [ [ 'text-a', [], 'foo', 'a', null, null, 'rtl' ], [ 'text-b', [], 'foo', null, null, 'c', 'rtl' ], [ 'text-c', [], 'foo', 'c', null, null, 'rtl' ] ], - [ + 'expectedOutputs' => [ [ 'count' => 0, 'dir' => 'rtl', @@ -251,7 +251,7 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { 'number' => 2, ] ], - [ + 'finalRefs' => [ 'foo' => [ 'a' => [ 'count' => 0, @@ -279,18 +279,18 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { ] ] ], - [ + 'finalCallStack' => [ [ 'new', 1, 'foo', 'a', null, 'text-a', [] ], [ 'new', 2, 'foo', null, null, 'text-b', [] ], [ 'new', 3, 'foo', 'c', null, 'text-c', [] ], ] ], 'Repeated ref, text in first tag' => [ - [ + 'refs' => [ [ 'text', [], 'foo', 'a', null, null, 'rtl' ], [ null, [], 'foo', 'a', null, null, 'rtl' ] ], - [ + 'expectedOutputs' => [ [ 'count' => 0, 'dir' => 'rtl', @@ -308,7 +308,7 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { 'number' => 1, ], ], - [ + 'finalRefs' => [ 'foo' => [ 'a' => [ 'count' => 1, @@ -320,17 +320,17 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { ] ] ], - [ + 'finalCallStack' => [ [ 'new', 1, 'foo', 'a', null, 'text', [] ], [ 'increment', 1, 'foo', 'a', null, null, [] ], ] ], 'Repeated ref, text in second tag' => [ - [ + 'refs' => [ [ null, [], 'foo', 'a', null, null, 'rtl' ], [ 'text', [], 'foo', 'a', null, null, 'rtl' ] ], - [ + 'expectedOutputs' => [ [ 'count' => 0, 'dir' => 'rtl', @@ -348,7 +348,7 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { 'number' => 1, ] ], - [ + 'finalRefs' => [ 'foo' => [ 'a' => [ 'count' => 1, @@ -360,17 +360,17 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { ] ] ], - [ + 'finalCallStack' => [ [ 'new', 1, 'foo', 'a', null, null, [] ], [ 'assign', 1, 'foo', 'a', null, 'text', [] ], ] ], 'Repeated ref, mismatched text' => [ - [ + 'refs' => [ [ 'text-1', [], 'foo', 'a', null, null, 'rtl' ], [ 'text-2', [], 'foo', 'a', null, null, 'rtl' ] ], - [ + 'expectedOutputs' => [ [ 'count' => 0, 'dir' => 'rtl', @@ -389,7 +389,7 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { 'warnings' => [ [ 'cite_error_references_duplicate_key', 'a' ] ], ] ], - [ + 'finalRefs' => [ 'foo' => [ 'a' => [ 'count' => 1, @@ -402,16 +402,16 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { ] ] ], - [ + 'finalCallStack' => [ [ 'new', 1, 'foo', 'a', null, 'text-1', [] ], [ 'increment', 1, 'foo', 'a', null, 'text-2', [] ], ] ], 'Named extends with no parent' => [ - [ + 'refs' => [ [ 'text-a', [], 'foo', 'a', 'b', null, 'rtl' ], ], - [ + 'expectedOutputs' => [ [ 'count' => 0, 'dir' => 'rtl', @@ -423,7 +423,7 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { 'extendsIndex' => 1, ], ], - [ + 'finalRefs' => [ 'foo' => [ 'a' => [ 'count' => 0, @@ -441,16 +441,16 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { ] ] ], - [ + 'finalCallStack' => [ [ 'new', 1, 'foo', 'a', 'b', 'text-a', [] ], ] ], 'Named extends before parent' => [ - [ + 'refs' => [ [ 'text-a', [], 'foo', 'a', 'b', null, 'rtl' ], [ 'text-b', [], 'foo', 'b', null, null, 'rtl' ], ], - [ + 'expectedOutputs' => [ [ 'count' => 0, 'dir' => 'rtl', @@ -470,7 +470,7 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { 'number' => 1, ] ], - [ + 'finalRefs' => [ 'foo' => [ 'a' => [ 'count' => 0, @@ -492,17 +492,17 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { ] ] ], - [ + 'finalCallStack' => [ [ 'new', 1, 'foo', 'a', 'b', 'text-a', [] ], [ 'new-from-placeholder', 2, 'foo', 'b', null, 'text-b', [] ], ] ], 'Named extends after parent' => [ - [ + 'refs' => [ [ 'text-a', [], 'foo', 'a', null, null, 'rtl' ], [ 'text-b', [], 'foo', 'b', 'a', null, 'rtl' ], ], - [ + 'expectedOutputs' => [ [ 'count' => 0, 'dir' => 'rtl', @@ -522,7 +522,7 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { 'extendsIndex' => 1, ] ], - [ + 'finalRefs' => [ 'foo' => [ 'a' => [ 'count' => 0, @@ -544,16 +544,16 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { ] ] ], - [ + 'finalCallStack' => [ [ 'new', 1, 'foo', 'a', null, 'text-a', [] ], [ 'new', 2, 'foo', 'b', 'a', 'text-b', [] ], ] ], 'Anonymous extends with no parent' => [ - [ + 'refs' => [ [ 'text-a', [], 'foo', null, 'b', null, 'rtl' ], ], - [ + 'expectedOutputs' => [ [ 'count' => -1, 'dir' => 'rtl', @@ -565,7 +565,7 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { 'extendsIndex' => 1, ] ], - [ + 'finalRefs' => [ 'foo' => [ 0 => [ 'count' => -1, @@ -583,16 +583,16 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { ] ], ], - [ + 'finalCallStack' => [ [ 'new', 1, 'foo', null, 'b', 'text-a', [] ], ] ], 'Anonymous extends before parent' => [ - [ + 'refs' => [ [ 'text-a', [], 'foo', null, 'b', null, 'rtl' ], [ 'text-b', [], 'foo', 'b', null, null, 'rtl' ], ], - [ + 'expectedOutputs' => [ [ 'count' => -1, 'dir' => 'rtl', @@ -612,7 +612,7 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { 'number' => 1, ] ], - [ + 'finalRefs' => [ 'foo' => [ 0 => [ 'count' => -1, @@ -634,17 +634,17 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { ] ] ], - [ + 'finalCallStack' => [ [ 'new', 1, 'foo', null, 'b', 'text-a', [] ], [ 'new-from-placeholder', 2, 'foo', 'b', null, 'text-b', [] ], ] ], 'Anonymous extends after parent' => [ - [ + 'refs' => [ [ 'text-a', [], 'foo', 'a', null, null, 'rtl' ], [ 'text-b', [], 'foo', null, 'a', null, 'rtl' ], ], - [ + 'expectedOutputs' => [ [ 'count' => 0, 'dir' => 'rtl', @@ -664,7 +664,7 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { 'extendsIndex' => 1, ] ], - [ + 'finalRefs' => [ 'foo' => [ 'a' => [ 'count' => 0, @@ -686,18 +686,18 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { ] ] ], - [ + 'finalCallStack' => [ [ 'new', 1, 'foo', 'a', null, 'text-a', [] ], [ 'new', 2, 'foo', null, 'a', 'text-b', [] ], ] ], 'Normal after extends' => [ - [ + 'refs' => [ [ 'text-a', [], 'foo', 'a', null, null, 'rtl' ], [ 'text-b', [], 'foo', null, 'a', null, 'rtl' ], [ 'text-c', [], 'foo', 'c', null, null, 'rtl' ], ], - [ + 'expectedOutputs' => [ [ 'count' => 0, 'dir' => 'rtl', @@ -725,7 +725,7 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { 'number' => 2, ], ], - [ + 'finalRefs' => [ 'foo' => [ 'a' => [ 'count' => 0, @@ -755,19 +755,19 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { ], ] ], - [ + 'finalCallStack' => [ [ 'new', 1, 'foo', 'a', null, 'text-a', [] ], [ 'new', 2, 'foo', null, 'a', 'text-b', [] ], [ 'new', 3, 'foo', 'c', null, 'text-c', [] ], ] ], 'Two incomplete follows' => [ - [ + 'refs' => [ [ 'text-a', [], 'foo', 'a', null, null, 'rtl' ], [ 'text-b', [], 'foo', null, null, 'd', 'rtl' ], [ 'text-c', [], 'foo', null, null, 'd', 'rtl' ], ], - [ + 'expectedOutputs' => [ [ 'count' => 0, 'dir' => 'rtl', @@ -779,7 +779,7 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { null, null ], - [ + 'finalRefs' => [ 'foo' => [ 'a' => [ 'count' => 0, @@ -807,7 +807,7 @@ class ReferenceStackTest extends \MediaWikiUnitTestCase { ], ] ], - [ + 'finalCallStack' => [ [ 'new', 1, 'foo', 'a', null, 'text-a', [] ], [ 'new', 2, 'foo', null, null, 'text-b', [] ], [ 'new', 3, 'foo', null, null, 'text-c', [] ], diff --git a/tests/phpunit/unit/ReferencesFormatterTest.php b/tests/phpunit/unit/ReferencesFormatterTest.php index 6b3486c2f..7b225c36c 100644 --- a/tests/phpunit/unit/ReferencesFormatterTest.php +++ b/tests/phpunit/unit/ReferencesFormatterTest.php @@ -50,22 +50,22 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase { public static function provideFormatReferences() { return [ 'Empty' => [ - [], - '' + 'refs' => [], + 'expectedOutput' => '' ], 'Minimal ref' => [ - [ + 'refs' => [ 0 => [ 'key' => 1, 'text' => 't', ] ], - '
    ' . "\n" . + 'expectedOutput' => '
      ' . "\n" . '
    1. (cite_references_link_many|||t' . "\n|)
    2. \n
    " ], 'Ref with extends' => [ - [ + 'refs' => [ 0 => [ 'extends' => 'a', 'extendsIndex' => 1, @@ -83,7 +83,7 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase { 'text' => 't1', ], ], - '
      ' . "\n" . + 'expectedOutput' => '
        ' . "\n" . '
      1. (cite_references_link_many|||t1' . "\n" . '|)
        1. (cite_references_link_many|||' . 't2' . "\n|)
        2. \n" . @@ -93,7 +93,7 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase { '
      ' ], 'Subref of subref' => [ - [ + 'refs' => [ 0 => [ 'extends' => 'a', 'extendsIndex' => 1, @@ -114,7 +114,7 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase { 'text' => 't3', ], ], - '
        ' . "\n" . + 'expectedOutput' => '
          ' . "\n" . '
        1. (cite_references_link_many|||t3' . "\n" . '|)
          1. (cite_references_link_many|||' . 't1 (cite_error_ref_nested_extends|a|b)' . @@ -124,11 +124,11 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase { '
        ' ], 'Use columns' => [ - array_map( + 'refs' => array_map( static fn ( $i ) => [ 'key' => $i, 'text' => 't' ], range( 0, 10 ) ), - '
          ' . + 'expectedOutput' => '
            ' . "\n" . '
          1. (cite_references_link_many|||t' . "\n|)
          2. \n" . '
          3. (cite_references_link_many|||t' . @@ -222,51 +222,51 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase { public static function provideFormatListItem() { return [ 'Success' => [ - [ + 'ref' => [ 'text' => 't', ], - '(cite_references_link_many|1-||t' . "\n|)" + 'expectedOutput' => '(cite_references_link_many|1-||t' . "\n|)" ], 'With dir' => [ - [ + 'ref' => [ 'dir' => 'rtl', 'text' => 't', ], - '(cite_references_link_many|1-||t' . + 'expectedOutput' => '(cite_references_link_many|1-||t' . "\n" . '| class="mw-cite-dir-rtl")' ], 'Incomplete follow' => [ - [ + 'ref' => [ 'follow' => 'f', 'text' => 't', ], - "

            t\n

            " + 'expectedOutput' => "

            t\n

            " ], 'Count zero' => [ - [ + 'ref' => [ 'count' => 0, 'key' => 5, 'text' => 't', ], - '(cite_references_link_one|1-5|1+5-0|t' . "\n|)" + 'expectedOutput' => '(cite_references_link_one|1-5|1+5-0|t' . "\n|)" ], 'Count negative' => [ - [ + 'ref' => [ 'count' => -1, 'key' => 5, 'number' => 3, 'text' => 't', ], - '(cite_references_link_one|5|5+|t' . "\n|)" + 'expectedOutput' => '(cite_references_link_one|5|5+|t' . "\n|)" ], 'Count positive' => [ - [ + 'ref' => [ 'count' => 2, 'key' => 5, 'number' => 3, 'text' => 't', ], - '(cite_references_link_many|1-5|(cite_references_link_many_format|1+5-0|3.0|' . + 'expectedOutput' => '(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)' . @@ -304,24 +304,24 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase { public static function provideReferenceText() { return [ 'No text, not preview' => [ - null, - false, - '(cite_error_references_no_text|1)' + 'text' => null, + 'isSectionPreview' => false, + 'expectedOutput' => '(cite_error_references_no_text|1)' ], 'No text, is preview' => [ - null, - true, - '(cite_warning_sectionpreview_no_text|1)' + 'text' => null, + 'isSectionPreview' => true, + 'expectedOutput' => '(cite_warning_sectionpreview_no_text|1)' ], 'Has text' => [ - 'text', - true, - 'text' . "\n" + 'text' => 'text', + 'isSectionPreview' => true, + 'expectedOutput' => 'text' . "\n" ], 'Trims text' => [ - "text\n\n", - true, - 'text' . "\n" + 'text' => "text\n\n", + 'isSectionPreview' => true, + 'expectedOutput' => 'text' . "\n" ], ]; } @@ -419,21 +419,21 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase { public static function provideLists() { return [ [ - [], - '' + 'list' => [], + 'expected' => '' ], [ // This is intentionally using numbers to test the to-string cast - [ 1 ], - '1' + 'list' => [ 1 ], + 'expected' => '1' ], [ - [ 1, 2 ], - '1(cite_references_link_many_and)2' + 'list' => [ 1, 2 ], + 'expected' => '1(cite_references_link_many_and)2' ], [ - [ 1, 2, 3 ], - '1(cite_references_link_many_sep)2(cite_references_link_many_and)3' + 'list' => [ 1, 2, 3 ], + 'expected' => '1(cite_references_link_many_sep)2(cite_references_link_many_and)3' ], ]; }