function testLangListWithWrongDir()
    {
        $GLOBALS['lang_path'] = '/root/';
        $expected = array('en' => PMA_langDetails('en'));

        $this->assertEquals($expected, PMA_langList());
    }
Example #2
0
/**
 * Returns list of languages supported by phpMyAdmin
 *
 * @return array
 */
function PMA_langList()
{
    /* We can always speak English */
    $result = array('en' => PMA_langDetails('en'));
    /* Check for existing directory */
    if (!is_dir($GLOBALS['lang_path'])) {
        return $result;
    }
    /* Open the directory */
    $handle = @opendir($GLOBALS['lang_path']);
    /* This can happen if the kit is English-only */
    if ($handle === false) {
        return $result;
    }
    /* Process all files */
    while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != ".." && file_exists($GLOBALS['lang_path'] . '/' . $file . '/LC_MESSAGES/phpmyadmin.mo')) {
            $result[$file] = PMA_langDetails($file);
        }
    }
    /* Close the handle */
    closedir($handle);
    return $result;
}
 /**
  * @dataProvider dataProvider
  */
 function testLangDetails($a, $b, $c,$d)
 {
     $this->assertEquals(array($a, $b, $c), PMA_langDetails($d));
 }