2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Test for PMA_langList from select_lang.lib.php
6 * @package phpMyAdmin-test
7 * @version $Id: PMA_langList_test.php
8 * @group select_lang.lib-tests
14 require_once 'libraries/select_lang.lib.php';
16 class PMA_langList_test
extends PHPUnit_Framework_TestCase
18 function testLangList()
20 $GLOBALS['lang_path'] = '';
21 $expected = array('en' => PMA_langDetails('en'));
23 $this->assertEquals($expected, PMA_langList());
26 function testLangListWithDir()
28 $GLOBALS['lang_path'] = './locale/';
29 $expected = array('en' => PMA_langDetails('en'));
31 $handle = @opendir
($GLOBALS['lang_path']);
32 if ($handle === false)
33 $this->markTestSkipped("Cannot open file with locales");
35 while (false !== ($file = readdir($handle))) {
36 if ($file != "." && $file != ".." && file_exists($GLOBALS['lang_path'] . '/' . $file . '/LC_MESSAGES/phpmyadmin.mo')) {
37 $expected[$file] = PMA_langDetails($file);
41 $this->assertEquals($expected, PMA_langList());
44 function testLangListWithWrongDir()
46 $GLOBALS['lang_path'] = '/root/';
47 $expected = array('en' => PMA_langDetails('en'));
49 $this->assertEquals($expected, PMA_langList());