Add a test for the localize function. re #96
This commit is contained in:
parent
3be4fce3a5
commit
9c09b8797c
2 changed files with 27 additions and 1 deletions
|
@ -11,4 +11,27 @@ class BaseTest extends PHPUnit_Framework_TestCase
|
|||
$this->assertEquals ("?key=value&db=0", addURLParameter ("?key=value", "db", "0"));
|
||||
$this->assertEquals ("?key=value&otherKey=&db=0", addURLParameter ("?key=value&otherKey", "db", "0"));
|
||||
}
|
||||
|
||||
public function testLocalize ()
|
||||
{
|
||||
$this->assertEquals ("Authors", localize ("authors.title"));
|
||||
}
|
||||
|
||||
public function testLocalizeFr ()
|
||||
{
|
||||
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = "fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3";
|
||||
$this->assertEquals ("Auteurs", localize ("authors.title", -1, true));
|
||||
|
||||
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = "en";
|
||||
localize ("authors.title", -1, true);
|
||||
}
|
||||
|
||||
public function testLocalizeUnknown ()
|
||||
{
|
||||
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = "aa";
|
||||
$this->assertEquals ("Authors", localize ("authors.title", -1, true));
|
||||
|
||||
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = "en";
|
||||
localize ("authors.title", -1, true);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue