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

Tests for SimpleSAML\Locale\Language::isLanguageRTL() + Typo.

parent 79b9a26e
No related branches found
No related tags found
No related merge requests found
......@@ -153,7 +153,7 @@ class Language
continue;
}
/* Some user agents use very limited precicion of the quality value, but order the elements in descending
/* Some user agents use very limited precision of the quality value, but order the elements in descending
* order. Therefore we rely on the order of the output from getAcceptLanguage() matching the order of the
* languages in the header when two languages have the same quality.
*/
......
......@@ -71,6 +71,36 @@ class LanguageTest extends \PHPUnit_Framework_TestCase
}
/**
* Test SimpleSAML\Locale\Language::isLanguageRTL().
*/
public function testIsLanguageRTL()
{
// test defaults
$c = \SimpleSAML_Configuration::loadFromArray(array(), '', 'simplesaml');
$l = new Language($c);
$l->setLanguage('en');
$this->assertFalse($l->isLanguageRTL());
// test non-defaults, non-RTL
$c = \SimpleSAML_Configuration::loadFromArray(array(
'language.rtl' => array('xx', 'yy', 'zz'),
), '', 'simplesaml');
$l = new Language($c);
$l->setLanguage('en');
$this->assertFalse($l->isLanguageRTL());
// test non-defaults, RTL
$c = \SimpleSAML_Configuration::loadFromArray(array(
'language.available' => array('xx', 'yy', 'zz', 'en'),
'language.rtl' => array('xx', 'yy'),
), '', 'simplesaml');
$l = new Language($c);
$l->setLanguage('yy');
$this->assertTrue($l->isLanguageRTL());
}
/**
* Test SimpleSAML\Locale\Language::setLanguage().
*/
......
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