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
|
<?php
declare(strict_types=1);
namespace PhpMyAdmin\MoTranslator\Tests;
use PhpMyAdmin\MoTranslator\Loader;
use PHPUnit\Framework\TestCase;
/**
* 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'));
}
}
|