mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-04 19:38:16 +00:00
e5cda65fbe
The name of the base class in tests is guaranteed to only occur a single time in a file. There is not much value in making it relative, and requiring it to appear in the use section. Especially because it is in the root namespace. This reflects what I once encoded in the sniff https://github.com/wmde/WikibaseCodeSniffer/blob/master/Wikibase/Sniffs/Namespaces/FullQualifiedClassNameSniff.php I wish we could pick this rule and use it in our codebases. But it seems it is to specific and can't be applied on all codebases, hence it can't become part of the upstream MediaWiki rule set. At least not at the moment. Change-Id: I77c2490c565b7a468c5c944301fc684d20206ec4
37 lines
1,009 B
PHP
37 lines
1,009 B
PHP
<?php
|
|
|
|
namespace Cite\Tests\Unit;
|
|
|
|
use Cite\ReferenceMessageLocalizer;
|
|
use Language;
|
|
|
|
/**
|
|
* @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' ) );
|
|
}
|
|
|
|
}
|