mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-24 06:54:00 +00:00
3d80501829
We never access Language directly, so proxy its method instead of returning the full object. I believe I've found a bug, but not fixing here: the footnote body numeric backlinks like "2.1" behave as if they were decimals rather than two numbers stuck together with a dot. So they are localized to "2,1". Bug: T239725 Change-Id: If386bf96d48cb95c0a287a02bedfe984941efe30
38 lines
1 KiB
PHP
38 lines
1 KiB
PHP
<?php
|
|
|
|
namespace Cite\Tests\Unit;
|
|
|
|
use Cite\ReferenceMessageLocalizer;
|
|
use Language;
|
|
use MediaWikiUnitTestCase;
|
|
|
|
/**
|
|
* @coversDefaultClass \Cite\ReferenceMessageLocalizer
|
|
*/
|
|
class ReferenceMessageLocalizerUnitTest extends MediaWikiUnitTestCase {
|
|
|
|
/**
|
|
* @covers ::formatNum
|
|
* @covers ::__construct
|
|
*/
|
|
public function testFormatNum() {
|
|
$mockLanguage = $this->createMock( Language::class );
|
|
$mockLanguage->method( 'formatNum' )->willReturn( '10,0' );
|
|
/** @var Language $mockLanguage */
|
|
$messageLocalizer = new ReferenceMessageLocalizer( $mockLanguage );
|
|
$this->assertSame( '10,0', $messageLocalizer->formatNum( '10.0' ) );
|
|
}
|
|
|
|
/**
|
|
* @covers ::formatNumNoSeparators
|
|
*/
|
|
public function testFormatNumNoSeparators() {
|
|
$mockLanguage = $this->createMock( Language::class );
|
|
$mockLanguage->method( 'formatNumNoSeparators' )->willReturn( 'ה' );
|
|
/** @var Language $mockLanguage */
|
|
$messageLocalizer = new ReferenceMessageLocalizer( $mockLanguage );
|
|
$this->assertSame( 'ה', $messageLocalizer->formatNumNoSeparators( '5' ) );
|
|
}
|
|
|
|
}
|