summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaime Perez Crespo <jaime.perez@uninett.no>2016-02-09 11:13:55 +0100
committerJaime Perez Crespo <jaime.perez@uninett.no>2016-02-09 11:13:55 +0100
commit0b1501e8b67fcbf09c39339466b9be4b8bfa77f3 (patch)
tree343e07732edf6ed773d3651e4b1538269cc28c54
parent79b9a26e777eae496b98a2f21323bfd5b7531330 (diff)
downloadsimplesamlphp-0b1501e8b67fcbf09c39339466b9be4b8bfa77f3.zip
simplesamlphp-0b1501e8b67fcbf09c39339466b9be4b8bfa77f3.tar.gz
simplesamlphp-0b1501e8b67fcbf09c39339466b9be4b8bfa77f3.tar.bz2
Tests for SimpleSAML\Locale\Language::isLanguageRTL() + Typo.
-rw-r--r--lib/SimpleSAML/Locale/Language.php2
-rw-r--r--tests/lib/SimpleSAML/Locale/LanguageTest.php30
2 files changed, 31 insertions, 1 deletions
diff --git a/lib/SimpleSAML/Locale/Language.php b/lib/SimpleSAML/Locale/Language.php
index f163c52..2bdcb68 100644
--- a/lib/SimpleSAML/Locale/Language.php
+++ b/lib/SimpleSAML/Locale/Language.php
@@ -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.
*/
diff --git a/tests/lib/SimpleSAML/Locale/LanguageTest.php b/tests/lib/SimpleSAML/Locale/LanguageTest.php
index 2a9bf63..68aee86 100644
--- a/tests/lib/SimpleSAML/Locale/LanguageTest.php
+++ b/tests/lib/SimpleSAML/Locale/LanguageTest.php
@@ -72,6 +72,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().
*/
public function testSetLanguage()