2019-12-06 09:12:25 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Cite\Tests\Unit;
|
|
|
|
|
|
|
|
use Cite\ReferenceMessageLocalizer;
|
|
|
|
use Language;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @coversDefaultClass \Cite\ReferenceMessageLocalizer
|
|
|
|
*/
|
2019-12-10 15:24:49 +00:00
|
|
|
class ReferenceMessageLocalizerUnitTest extends \MediaWikiUnitTestCase {
|
2019-12-06 09:12:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @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' ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-12-10 15:21:12 +00:00
|
|
|
* @covers ::localizeDigits
|
2019-12-06 09:12:25 +00:00
|
|
|
*/
|
2019-12-10 15:21:12 +00:00
|
|
|
public function testLocalizeDigits() {
|
2019-12-06 09:12:25 +00:00
|
|
|
$mockLanguage = $this->createMock( Language::class );
|
|
|
|
$mockLanguage->method( 'formatNumNoSeparators' )->willReturn( 'ה' );
|
|
|
|
/** @var Language $mockLanguage */
|
|
|
|
$messageLocalizer = new ReferenceMessageLocalizer( $mockLanguage );
|
2019-12-10 15:21:12 +00:00
|
|
|
$this->assertSame( 'ה', $messageLocalizer->localizeDigits( '5' ) );
|
2019-12-06 09:12:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|