updated packages
This commit is contained in:
@@ -31,7 +31,7 @@ class IntlFormatterTest extends \PHPUnit\Framework\TestCase
|
||||
public function testInvalidFormat()
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
(new IntlFormatter())->formatIntl('{foo', 'en', array(2));
|
||||
(new IntlFormatter())->formatIntl('{foo', 'en', [2]);
|
||||
}
|
||||
|
||||
public function testFormatWithNamedArguments()
|
||||
@@ -59,38 +59,38 @@ class IntlFormatterTest extends \PHPUnit\Framework\TestCase
|
||||
other {{host} invites {guest} as one of the # people invited to their party.}}}}
|
||||
_MSG_;
|
||||
|
||||
$message = (new IntlFormatter())->formatIntl($chooseMessage, 'en', array(
|
||||
$message = (new IntlFormatter())->formatIntl($chooseMessage, 'en', [
|
||||
'gender_of_host' => 'male',
|
||||
'num_guests' => 10,
|
||||
'host' => 'Fabien',
|
||||
'guest' => 'Guilherme',
|
||||
));
|
||||
]);
|
||||
|
||||
$this->assertEquals('Fabien invites Guilherme as one of the 9 people invited to his party.', $message);
|
||||
}
|
||||
|
||||
public function provideDataForFormat()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
return [
|
||||
[
|
||||
'There is one apple',
|
||||
'There is one apple',
|
||||
array(),
|
||||
),
|
||||
array(
|
||||
[],
|
||||
],
|
||||
[
|
||||
'4,560 monkeys on 123 trees make 37.073 monkeys per tree',
|
||||
'{0,number,integer} monkeys on {1,number,integer} trees make {2,number} monkeys per tree',
|
||||
array(4560, 123, 4560 / 123),
|
||||
),
|
||||
);
|
||||
[4560, 123, 4560 / 123],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function testPercentsAndBracketsAreTrimmed()
|
||||
{
|
||||
$formatter = new IntlFormatter();
|
||||
$this->assertInstanceof(IntlFormatterInterface::class, $formatter);
|
||||
$this->assertSame('Hello Fab', $formatter->formatIntl('Hello {name}', 'en', array('name' => 'Fab')));
|
||||
$this->assertSame('Hello Fab', $formatter->formatIntl('Hello {name}', 'en', array('%name%' => 'Fab')));
|
||||
$this->assertSame('Hello Fab', $formatter->formatIntl('Hello {name}', 'en', array('{{ name }}' => 'Fab')));
|
||||
$this->assertSame('Hello Fab', $formatter->formatIntl('Hello {name}', 'en', ['name' => 'Fab']));
|
||||
$this->assertSame('Hello Fab', $formatter->formatIntl('Hello {name}', 'en', ['%name%' => 'Fab']));
|
||||
$this->assertSame('Hello Fab', $formatter->formatIntl('Hello {name}', 'en', ['{{ name }}' => 'Fab']));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user