| 1 | <?php |
||
| 4 | class TranslationTest extends \PHPUnit_Framework_TestCase |
||
| 5 | { |
||
| 6 | const EXPRESSION = "Let me test this expression"; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * @before |
||
| 10 | */ |
||
| 11 | public function testFrenchLocale() |
||
| 12 | { |
||
| 13 | $config = array( |
||
| 14 | 'gettext_locale_dir' => 'testTranslations', |
||
| 15 | 'gettext_text_domain' => 'my-domain', |
||
| 16 | 'gettext_catalog_codeset' => 'UTF-8', |
||
| 17 | 'gettext_locale' => 'fr_FR' |
||
| 18 | ); |
||
| 19 | |||
| 20 | // only for avoid output when launch test |
||
| 21 | $this->expectOutputRegex('//'); |
||
| 22 | |||
| 23 | \Gettext::init($config); |
||
| 24 | } |
||
| 25 | |||
| 26 | public function testDoubleUnderscore() |
||
| 27 | { |
||
| 28 | $this->assertEquals("Une expression en Français", __("A expression in English")); |
||
| 29 | } |
||
| 30 | |||
| 31 | public function testUnderscroreE() |
||
| 32 | { |
||
| 33 | $this->expectOutputRegex("/(Une expression en Français)$/"); |
||
| 34 | _e("A expression in English"); |
||
| 35 | } |
||
| 36 | |||
| 37 | public function testUnderscroreN_Singular() |
||
| 38 | { |
||
| 39 | $this->assertEquals( |
||
| 40 | "Une expression en Français", __("A expression in English"), 1 |
||
| 41 | ); |
||
| 42 | } |
||
| 43 | |||
| 44 | public function testUnderscroreN_Plural() |
||
| 45 | { |
||
| 46 | $this->assertEquals( |
||
| 47 | "Une expression en Français", __("A expression in English"), 2 |
||
| 48 | ); |
||
| 49 | } |
||
| 50 | |||
| 51 | } |