mediawiki-extensions-Cite/tests/phpunit/unit/ReferenceMessageLocalizerUnitTest.php
Thiemo Kreuz 75016551e7 Rename formatNumNoSeparators() to localizeDigits()
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
2019-12-10 16:21:12 +01:00

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' ) );
}
}