mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-01 01:56:20 +00:00
75016551e7
Because that is what it does. Note our method is different from the one in the Language class. We only accept strings. Change-Id: I39107e837cc29f2d7c8867c1e602aa643f9e1a57
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 ::localizeDigits
|
|
*/
|
|
public function testLocalizeDigits() {
|
|
$mockLanguage = $this->createMock( Language::class );
|
|
$mockLanguage->method( 'formatNumNoSeparators' )->willReturn( 'ה' );
|
|
/** @var Language $mockLanguage */
|
|
$messageLocalizer = new ReferenceMessageLocalizer( $mockLanguage );
|
|
$this->assertSame( 'ה', $messageLocalizer->localizeDigits( '5' ) );
|
|
}
|
|
|
|
}
|