Skip to content
Snippets Groups Projects
Commit 486bd878 authored by Jaime Perez Crespo's avatar Jaime Perez Crespo
Browse files

Tests for SimpleSAML\Locale\Language::getLanguageList().

parent 0b1501e8
No related branches found
No related tags found
No related merge requests found
......@@ -47,11 +47,36 @@ class LanguageTest extends \PHPUnit_Framework_TestCase
'language.available' => array('xx', 'yy', 'zz'),
'language.cookie.name' => 'xyz'
), '', 'simplesaml');
$_COOKIE['xyz'] = 'yy';
$_COOKIE['xyz'] = 'Yy'; // test values are converted to lowercase too
$this->assertEquals('yy', Language::getLanguageCookie());
}
/**
* Test SimpleSAML\Locale\Language::getLanguageList().
*/
public function testGetLanguageList()
{
// test defaults
$c = \SimpleSAML_Configuration::loadFromArray(array(), '', 'simplesaml');
$l = new Language($c);
$l->setLanguage('en');
$this->assertEquals(array('en' => true), $l->getLanguageList());
// test non-defaults
$c = \SimpleSAML_Configuration::loadFromArray(array(
'language.available' => array('xx', 'yy', 'zz'),
), '', 'simplesaml');
$l = new Language($c);
$l->setLanguage('yy');
$this->assertEquals(array(
'xx' => false,
'yy' => true,
'zz' => false,
), $l->getLanguageList());
}
/**
* Test SimpleSAML\Locale\Language::getLanguageParameterName().
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment