4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Translation\Tests
;
14 use Symfony\Component\Translation\IdentityTranslator
;
15 use Symfony\Component\Translation\MessageSelector
;
17 class IdentityTranslatorTest
extends \PHPUnit_Framework_TestCase
20 * @dataProvider getTransTests
22 public function testTrans($expected, $id, $parameters)
24 $translator = new IdentityTranslator(new MessageSelector());
26 $this->assertEquals($expected, $translator->trans($id, $parameters));
30 * @dataProvider getTransChoiceTests
32 public function testTransChoice($expected, $id, $number, $parameters)
34 $translator = new IdentityTranslator(new MessageSelector());
36 $this->assertEquals($expected, $translator->transChoice($id, $number, $parameters));
40 public function testGetSetLocale()
42 $translator = new IdentityTranslator(new MessageSelector());
43 $translator->setLocale('en');
44 $translator->getLocale();
47 public function getTransTests()
50 array('Symfony2 is great!', 'Symfony2 is great!', array()),
51 array('Symfony2 is awesome!', 'Symfony2 is %what%!', array('%what%' => 'awesome')),
55 public function getTransChoiceTests()
58 array('There is 10 apples', '{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples', 10, array('%count%' => 10)),