1 | <?php |
||
26 | class HordeTranslationHandlerTest extends PHPUnit_Framework_TestCase { |
||
27 | |||
28 | private $handler; |
||
29 | |||
30 | protected function setUp() { |
||
31 | parent::setUp(); |
||
32 | |||
33 | $this->handler = new HordeTranslationHandler(); |
||
34 | } |
||
35 | |||
36 | public function testT() { |
||
37 | $message = 'Hello'; |
||
38 | |||
39 | $expected = $message; |
||
40 | $actual = $this->handler->t($message); |
||
41 | |||
42 | $this->assertEquals($expected, $actual); |
||
43 | } |
||
44 | |||
45 | public function singularPluralDataProvider() { |
||
46 | return [ |
||
47 | [0], |
||
48 | [1], |
||
49 | [2], |
||
50 | ]; |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @dataProvider singularPluralDataProvider |
||
55 | */ |
||
56 | public function testNgettext($number) { |
||
57 | $singular = 'mail'; |
||
58 | $plural = 'mails'; |
||
59 | |||
60 | $expected = $number > 1 ? $plural : $singular; |
||
61 | $actual = $this->handler->ngettext($singular, $plural, $number); |
||
62 | |||
63 | $this->assertEquals($expected, $actual); |
||
64 | } |
||
65 | |||
66 | } |
||
67 |