'48 hours 0 minutes',
'formatTimePeriod() rounding (=48h), avoidseconds'
],
+ [
+ 259199.55,
+ 'avoidhours',
+ '3 d',
+ 'formatTimePeriod() rounding (>48h), avoidhours'
+ ],
+ [
+ 259199.55,
+ [ 'avoid' => 'avoidhours', 'noabbrevs' => true ],
+ '3 days',
+ 'formatTimePeriod() rounding (>48h), avoidhours'
+ ],
[
259199.55,
'avoidminutes',
'平成24',
'nengo'
],
+ [
+ 'xtY',
+ '20190430235959',
+ '平成31',
+ '平成31',
+ 'nengo - last day of heisei'
+ ],
+ [
+ 'xtY',
+ '20190501000000',
+ '令和元',
+ '令和元',
+ 'nengo - first day of reiwa'
+ ],
+ [
+ 'xtY',
+ '20200501000000',
+ '令和2',
+ '令和2',
+ 'nengo - second year of reiwa'
+ ],
[
'xrxkYY',
'20120102090705',
$s = $lang->getMessageFromDB( 'word-separator' );
$c = $lang->getMessageFromDB( 'comma-separator' );
- $this->assertEquals( '', $lang->listToText( [] ) );
+ $this->assertSame( '', $lang->listToText( [] ) );
$this->assertEquals( 'a', $lang->listToText( [ 'a' ] ) );
$this->assertEquals( "a{$and}{$s}b", $lang->listToText( [ 'a', 'b' ] ) );
$this->assertEquals( "a{$c}b{$and}{$s}c", $lang->listToText( [ 'a', 'b', 'c' ] ) );
$ar2 = new LanguageAr();
$this->assertTrue( $ar1->equals( $ar2 ), 'ar equals ar' );
}
+
+ /**
+ * @dataProvider provideUcfirst
+ * @covers Language::ucfirst
+ */
+ public function testUcfirst( $orig, $expected, $desc, $overrides = false ) {
+ $lang = new Language();
+ if ( is_array( $overrides ) ) {
+ $this->setMwGlobals( [ 'wgOverrideUcfirstCharacters' => $overrides ] );
+ }
+ $this->assertSame( $lang->ucfirst( $orig ), $expected, $desc );
+ }
+
+ public static function provideUcfirst() {
+ return [
+ [ 'alice', 'Alice', 'simple ASCII string', false ],
+ [ 'århus', 'Århus', 'unicode string', false ],
+ //overrides do not affect ASCII characters
+ [ 'foo', 'Foo', 'ASCII is not overriden', [ 'f' => 'b' ] ],
+ // but they do affect non-ascii ones
+ [ 'èl', 'Ll' , 'Non-ASCII is overridden', [ 'è' => 'L' ] ],
+ ];
+ }
}