Merge "Replace extremely slow parser test with fast unit tests"

This commit is contained in:
jenkins-bot 2023-07-28 01:05:39 +00:00 committed by Gerrit Code Review
commit 0fc08a2ac7
4 changed files with 11 additions and 2437 deletions

File diff suppressed because one or more lines are too long

View file

@ -67,11 +67,10 @@ class FootnoteMarkFormatterTest extends \MediaWikiIntegrationTestCase {
'',
[
'name' => null,
'number' => 3,
'key' => 4,
'count' => -1,
'number' => 50003,
'key' => 50004,
],
'(cite_reference_link|4+|4|3)'
'(cite_reference_link|50004+|50004|50003)'
],
'Default label, named group' => [
'bar',
@ -79,7 +78,6 @@ class FootnoteMarkFormatterTest extends \MediaWikiIntegrationTestCase {
'name' => null,
'number' => 3,
'key' => 4,
'count' => -1,
],
'(cite_reference_link|4+|4|bar 3)'
],
@ -89,7 +87,6 @@ class FootnoteMarkFormatterTest extends \MediaWikiIntegrationTestCase {
'name' => null,
'number' => 3,
'key' => 4,
'count' => -1,
],
'(cite_reference_link|4+|4|c)'
],
@ -99,7 +96,6 @@ class FootnoteMarkFormatterTest extends \MediaWikiIntegrationTestCase {
'name' => null,
'number' => 10,
'key' => 4,
'count' => -1,
],
'(cite_reference_link|4+|4|' .
'cite_error_no_link_label_group|foo|cite_link_label_group-foo)'
@ -110,6 +106,7 @@ class FootnoteMarkFormatterTest extends \MediaWikiIntegrationTestCase {
'name' => 'a',
'number' => 3,
'key' => 4,
// Count is only meaningful on named refs; 0 means not reused
'count' => 0,
],
'(cite_reference_link|a+4-0|a-4|3)'
@ -120,9 +117,9 @@ class FootnoteMarkFormatterTest extends \MediaWikiIntegrationTestCase {
'name' => 'a',
'number' => 3,
'key' => 4,
'count' => 2,
'count' => 50002,
],
'(cite_reference_link|a+4-2|a-4|3)'
'(cite_reference_link|a+4-50002|a-4|3)'
],
'Subreference' => [
'',
@ -130,11 +127,10 @@ class FootnoteMarkFormatterTest extends \MediaWikiIntegrationTestCase {
'name' => null,
'number' => 3,
'key' => 4,
'count' => -1,
'extends' => 'b',
'extendsIndex' => 2,
'extendsIndex' => 50002,
],
'(cite_reference_link|4+|4|3.2)'
'(cite_reference_link|4+|4|3.50002)'
],
];
}

View file

@ -26,9 +26,9 @@ class ReferenceMessageLocalizerUnitTest extends \MediaWikiUnitTestCase {
*/
public function testLocalizeDigits() {
$mockLanguage = $this->createNoOpMock( Language::class, [ 'formatNumNoSeparators' ] );
$mockLanguage->method( 'formatNumNoSeparators' )->willReturn( 'ה' );
$mockLanguage->method( 'formatNumNoSeparators' )->willReturnArgument( 0 );
$messageLocalizer = new ReferenceMessageLocalizer( $mockLanguage );
$this->assertSame( 'ה', $messageLocalizer->localizeDigits( '5' ) );
$this->assertSame( '50005', $messageLocalizer->localizeDigits( '50005' ) );
}
}

View file

@ -424,6 +424,7 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase {
yield [ '1.2', 1, 2, 9 ];
yield [ '1.02', 1, 2, 99 ];
yield [ '1.002', 1, 2, 100 ];
yield [ '1.50005', 1, 50005, 50005 ];
yield [ '2.1', 2, 1, 1 ];
}