-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathFunctionsTest.php
71 lines (56 loc) · 1.7 KB
/
FunctionsTest.php
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
declare(strict_types=1);
namespace PhpMyAdmin\MoTranslator\Tests;
use PhpMyAdmin\MoTranslator\Loader;
use PHPUnit\Framework\TestCase;
use function __;
use function _bind_textdomain_codeset;
use function _bindtextdomain;
use function _dgettext;
use function _dngettext;
use function _dnpgettext;
use function _dpgettext;
use function _gettext;
use function _ngettext;
use function _npgettext;
use function _pgettext;
use function _setlocale;
use function _textdomain;
/**
* Test for functions.
*/
class FunctionsTest extends TestCase
{
public function setUp(): void
{
Loader::loadFunctions();
_setlocale(0, 'cs');
_textdomain('phpmyadmin');
_bindtextdomain('phpmyadmin', __DIR__ . '/data/locale/');
_bind_textdomain_codeset('phpmyadmin', 'UTF-8');
}
public function testGettext(): void
{
self::assertSame(
'Typ',
_gettext('Type'),
);
self::assertSame(
'Typ',
__('Type'),
);
self::assertSame('%d sekundy', _ngettext('%d second', '%d seconds', 2));
self::assertSame('%d seconds', _npgettext('context', '%d second', '%d seconds', 2));
self::assertSame('Tabulka', _pgettext('Display format', 'Table'));
}
public function testDomain(): void
{
self::assertSame(
'Typ',
_dgettext('phpmyadmin', 'Type'),
);
self::assertSame('%d sekundy', _dngettext('phpmyadmin', '%d second', '%d seconds', 2));
self::assertSame('%d seconds', _dnpgettext('phpmyadmin', 'context', '%d second', '%d seconds', 2));
self::assertSame('Tabulka', _dpgettext('phpmyadmin', 'Display format', 'Table'));
}
}