Compact trivial arrays in test providers

This is meant to make the code easier to read.

Change-Id: Ib684bf64acfbac9b458d110d9ccff2d071b993be
This commit is contained in:
Thiemo Kreuz 2020-10-08 11:07:35 +02:00
parent aef34e22ab
commit 27c5632ebd
3 changed files with 11 additions and 47 deletions

View file

@ -137,7 +137,7 @@ class ReferencesFormatter {
$parserInput .= $this->formatListItem( $parser, $key, $value, $isSectionPreview ) . "\n";
}
$parserInput .= $this->closeIndention( $indented );
return Html::rawElement( 'ol', [ 'class' => [ 'references' ] ], $parserInput );
return Html::rawElement( 'ol', [ 'class' => 'references' ], $parserInput );
}
/**

View file

@ -66,48 +66,24 @@ class CiteIntegrationTest extends \MediaWikiIntegrationTestCase {
public function provideCheckRefsNoReferences() {
return [
'Default group' => [
[
'' => [
[
'name' => 'a',
]
]
],
[ '' => [ [ 'name' => 'a' ] ] ],
false,
"\n" . '<references />'
],
'Default group in preview' => [
[
'' => [
[
'name' => 'a',
]
]
],
[ '' => [ [ 'name' => 'a' ] ] ],
true,
"\n" . '<div class="mw-ext-cite-cite_section_preview_references">' .
'<h2 id="mw-ext-cite-cite_section_preview_references_header">' .
'(cite_section_preview_references)</h2>' . "\n" . '<references /></div>'
],
'Named group' => [
[
'foo' => [
[
'name' => 'a',
]
]
],
[ 'foo' => [ [ 'name' => 'a' ] ] ],
false,
"\n" . '<br />(cite_error_group_refs_without_references|foo)'
],
'Named group in preview' => [
[
'foo' => [
[
'name' => 'a',
]
]
],
[ 'foo' => [ [ 'name' => 'a' ] ] ],
true,
"\n" . '<div class="mw-ext-cite-cite_section_preview_references">' .
'<h2 id="mw-ext-cite-cite_section_preview_references_header">' .

View file

@ -523,9 +523,7 @@ class CiteUnitTest extends \MediaWikiUnitTestCase {
return [
'Whitespace text' => [
' ',
[
'name' => 'a',
],
[ 'name' => 'a' ],
null,
[],
'<foot />',
@ -554,9 +552,7 @@ class CiteUnitTest extends \MediaWikiUnitTestCase {
],
'Fallback to references group' => [
'text',
[
'name' => 'a',
],
[ 'name' => 'a' ],
'foo',
[
'foo' => [
@ -573,9 +569,7 @@ class CiteUnitTest extends \MediaWikiUnitTestCase {
],
'Successful ref' => [
'text',
[
'name' => 'a',
],
[ 'name' => 'a' ],
null,
[],
'<foot />',
@ -607,9 +601,7 @@ class CiteUnitTest extends \MediaWikiUnitTestCase {
],
'Successful references ref' => [
'text',
[
'name' => 'a',
],
[ 'name' => 'a' ],
'',
[
'' => [
@ -640,15 +632,11 @@ class CiteUnitTest extends \MediaWikiUnitTestCase {
],
'Mismatched text in references' => [
'text-2',
[
'name' => 'a',
],
[ 'name' => 'a' ],
'',
[
'' => [
'a' => [
'text' => 'text-1',
]
'a' => [ 'text' => 'text-1' ],
]
],
'',