blob: 669cc0eecfeb9f1625f849776ca9032fbafb0e57 (
plain)
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
|
<?php
/**
* Tests for working locales
*
* @package PhpMyAdmin-test
*/
/*
* Include to test.
*/
require_once 'libraries/select_lang.lib.php';
/**
* Class for testing correctness of locales.
*
* @package PhpMyAdmin-test
*/
class PMA_Languages_Test extends PHPUnit_Framework_TestCase
{
/**
* Test for setting and parsing locales
*
* @param string $locale locale name
*
* @return void
*
* @group large
* @dataProvider listLocales
*/
public function testGettext($locale)
{
/* We should be able to set the language */
$this->assertTrue(PMA_langSet($locale));
/* Bind locales */
_setlocale(LC_MESSAGES, $GLOBALS['lang']);
_bind_textdomain_codeset('phpmyadmin', 'UTF-8');
_textdomain('phpmyadmin');
/* Grab some texts */
$this->assertContains('%s', _ngettext('%s table', '%s tables', 10));
$this->assertContains('%s', _ngettext('%s table', '%s tables', 1));
}
/**
* Data provider to generate list of available locales.
*
* @return array with arrays of available locales
*/
public function listLocales()
{
$ret = array();
foreach ($GLOBALS['available_languages'] as $key => $val) {
$ret[] = array($key);
}
return $ret;
}
}
?>
|