aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/LanguagesTest.php
blob: 79c136c88d5dea79ab89f1ebf24603685fc27245 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php

require_once 'application/Languages.php';

/**
 * Class LanguagesTest.
 */
class LanguagesTest extends PHPUnit_Framework_TestCase
{
    /**
     * Test t() with a simple non identified value.
     */
    public function testTranslateSingleNotID()
    {
        $text = 'abcdé 564 fgK';
        $this->assertEquals($text, t($text));
    }

    /**
     * Test t() with a non identified plural form.
     */
    public function testTranslatePluralNotID()
    {
        $text = '%s sandwich';
        $nText = '%s sandwiches';
        $this->assertEquals('0 sandwich', t($text, $nText));
        $this->assertEquals('1 sandwich', t($text, $nText, 1));
        $this->assertEquals('2 sandwiches', t($text, $nText, 2));
    }

    /**
     * Test t() with a non identified invalid plural form.
     */
    public function testTranslatePluralNotIDInvalid()
    {
        $text = 'sandwich';
        $nText = 'sandwiches';
        $this->assertEquals('sandwich', t($text, $nText, 1));
        $this->assertEquals('sandwiches', t($text, $nText, 2));
    }
}