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

Add some initial tests for the new SimpleSAML\Locale\Language class.

parent 4c68e5ea
No related branches found
No related tags found
No related merge requests found
<?php
namespace SimpleSAML\Test\Locale;
use SimpleSAML\Locale\Language;
class LanguageTest extends \PHPUnit_Framework_TestCase
{
/**
* Test SimpleSAML\Locale\Language::getLanguageCookie().
*/
public function testGetLanguageCookie()
{
// test it works when no cookie is set
\SimpleSAML_Configuration::loadFromArray(array(), '', 'simplesaml');
$this->assertNull(Language::getLanguageCookie());
// test that it works fine with defaults
\SimpleSAML_Configuration::loadFromArray(array(), '', 'simplesaml');
$_COOKIE['language'] = 'en';
$this->assertEquals('en', Language::getLanguageCookie());
// test that it works with non-defaults
\SimpleSAML_Configuration::loadFromArray(array(
'language.available' => array('xx', 'yy', 'zz'),
'language.cookie.name' => 'xyz'
), '', 'simplesaml');
$_COOKIE['xyz'] = 'yy';
$this->assertEquals('yy', Language::getLanguageCookie());
}
}
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