mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-28 00:40:12 +00:00
Merge "Replace extremely slow parser test with fast unit tests"
This commit is contained in:
commit
0fc08a2ac7
File diff suppressed because one or more lines are too long
|
@ -67,11 +67,10 @@ class FootnoteMarkFormatterTest extends \MediaWikiIntegrationTestCase {
|
||||||
'',
|
'',
|
||||||
[
|
[
|
||||||
'name' => null,
|
'name' => null,
|
||||||
'number' => 3,
|
'number' => 50003,
|
||||||
'key' => 4,
|
'key' => 50004,
|
||||||
'count' => -1,
|
|
||||||
],
|
],
|
||||||
'(cite_reference_link|4+|4|3)'
|
'(cite_reference_link|50004+|50004|50003)'
|
||||||
],
|
],
|
||||||
'Default label, named group' => [
|
'Default label, named group' => [
|
||||||
'bar',
|
'bar',
|
||||||
|
@ -79,7 +78,6 @@ class FootnoteMarkFormatterTest extends \MediaWikiIntegrationTestCase {
|
||||||
'name' => null,
|
'name' => null,
|
||||||
'number' => 3,
|
'number' => 3,
|
||||||
'key' => 4,
|
'key' => 4,
|
||||||
'count' => -1,
|
|
||||||
],
|
],
|
||||||
'(cite_reference_link|4+|4|bar 3)'
|
'(cite_reference_link|4+|4|bar 3)'
|
||||||
],
|
],
|
||||||
|
@ -89,7 +87,6 @@ class FootnoteMarkFormatterTest extends \MediaWikiIntegrationTestCase {
|
||||||
'name' => null,
|
'name' => null,
|
||||||
'number' => 3,
|
'number' => 3,
|
||||||
'key' => 4,
|
'key' => 4,
|
||||||
'count' => -1,
|
|
||||||
],
|
],
|
||||||
'(cite_reference_link|4+|4|c)'
|
'(cite_reference_link|4+|4|c)'
|
||||||
],
|
],
|
||||||
|
@ -99,7 +96,6 @@ class FootnoteMarkFormatterTest extends \MediaWikiIntegrationTestCase {
|
||||||
'name' => null,
|
'name' => null,
|
||||||
'number' => 10,
|
'number' => 10,
|
||||||
'key' => 4,
|
'key' => 4,
|
||||||
'count' => -1,
|
|
||||||
],
|
],
|
||||||
'(cite_reference_link|4+|4|' .
|
'(cite_reference_link|4+|4|' .
|
||||||
'cite_error_no_link_label_group|foo|cite_link_label_group-foo)'
|
'cite_error_no_link_label_group|foo|cite_link_label_group-foo)'
|
||||||
|
@ -110,6 +106,7 @@ class FootnoteMarkFormatterTest extends \MediaWikiIntegrationTestCase {
|
||||||
'name' => 'a',
|
'name' => 'a',
|
||||||
'number' => 3,
|
'number' => 3,
|
||||||
'key' => 4,
|
'key' => 4,
|
||||||
|
// Count is only meaningful on named refs; 0 means not reused
|
||||||
'count' => 0,
|
'count' => 0,
|
||||||
],
|
],
|
||||||
'(cite_reference_link|a+4-0|a-4|3)'
|
'(cite_reference_link|a+4-0|a-4|3)'
|
||||||
|
@ -120,9 +117,9 @@ class FootnoteMarkFormatterTest extends \MediaWikiIntegrationTestCase {
|
||||||
'name' => 'a',
|
'name' => 'a',
|
||||||
'number' => 3,
|
'number' => 3,
|
||||||
'key' => 4,
|
'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' => [
|
'Subreference' => [
|
||||||
'',
|
'',
|
||||||
|
@ -130,11 +127,10 @@ class FootnoteMarkFormatterTest extends \MediaWikiIntegrationTestCase {
|
||||||
'name' => null,
|
'name' => null,
|
||||||
'number' => 3,
|
'number' => 3,
|
||||||
'key' => 4,
|
'key' => 4,
|
||||||
'count' => -1,
|
|
||||||
'extends' => 'b',
|
'extends' => 'b',
|
||||||
'extendsIndex' => 2,
|
'extendsIndex' => 50002,
|
||||||
],
|
],
|
||||||
'(cite_reference_link|4+|4|3.2)'
|
'(cite_reference_link|4+|4|3.50002)'
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,9 @@ class ReferenceMessageLocalizerUnitTest extends \MediaWikiUnitTestCase {
|
||||||
*/
|
*/
|
||||||
public function testLocalizeDigits() {
|
public function testLocalizeDigits() {
|
||||||
$mockLanguage = $this->createNoOpMock( Language::class, [ 'formatNumNoSeparators' ] );
|
$mockLanguage = $this->createNoOpMock( Language::class, [ 'formatNumNoSeparators' ] );
|
||||||
$mockLanguage->method( 'formatNumNoSeparators' )->willReturn( 'ה' );
|
$mockLanguage->method( 'formatNumNoSeparators' )->willReturnArgument( 0 );
|
||||||
$messageLocalizer = new ReferenceMessageLocalizer( $mockLanguage );
|
$messageLocalizer = new ReferenceMessageLocalizer( $mockLanguage );
|
||||||
$this->assertSame( 'ה', $messageLocalizer->localizeDigits( '5' ) );
|
$this->assertSame( '50005', $messageLocalizer->localizeDigits( '50005' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,6 +424,7 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase {
|
||||||
yield [ '1.2', 1, 2, 9 ];
|
yield [ '1.2', 1, 2, 9 ];
|
||||||
yield [ '1.02', 1, 2, 99 ];
|
yield [ '1.02', 1, 2, 99 ];
|
||||||
yield [ '1.002', 1, 2, 100 ];
|
yield [ '1.002', 1, 2, 100 ];
|
||||||
|
yield [ '1.50005', 1, 50005, 50005 ];
|
||||||
yield [ '2.1', 2, 1, 1 ];
|
yield [ '2.1', 2, 1, 1 ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue