Skip to content

Commit 0d88759

Browse files
committed
Add tests for calling trans with ICU messages
1 parent c15cd78 commit 0d88759

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/Symfony/Component/Translation/Tests/TranslatorTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,14 @@ public function testTrans($expected, $id, $translation, $parameters, $locale, $d
368368
$this->assertEquals($expected, $translator->trans($id, $parameters, $domain, $locale));
369369
}
370370

371+
/**
372+
* @dataProvider getTransICUTests
373+
*/
374+
public function testTransICU(...$args)
375+
{
376+
$this->testTrans(...$args);
377+
}
378+
371379
/**
372380
* @dataProvider getInvalidLocalesTests
373381
*/
@@ -444,6 +452,16 @@ public function getTransTests()
444452
];
445453
}
446454

455+
public function getTransICUTests()
456+
{
457+
$id = '{apples, plural, =0 {There are no apples} one {There is one apple} other {There are # apples}}';
458+
return [
459+
['There are no apples', $id, $id, ['{apples}' => 0], 'en', 'test' . MessageCatalogue::INTL_DOMAIN_SUFFIX],
460+
['There is one apple', $id, $id, ['{apples}' => 1], 'en', 'test' . MessageCatalogue::INTL_DOMAIN_SUFFIX],
461+
['There are 3 apples', $id, $id, ['{apples}' => 3], 'en', 'test' . MessageCatalogue::INTL_DOMAIN_SUFFIX],
462+
];
463+
}
464+
447465
public function getFlattenedTransTests()
448466
{
449467
$messages = [

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy