test(phpunit): Improve locale-related tests

This commit is contained in:
Pierre Rudloff 2019-04-20 12:17:52 +02:00
parent 0283ef6928
commit f4654c7229
2 changed files with 14 additions and 5 deletions

View file

@ -26,19 +26,18 @@ class LocaleManagerTest extends TestCase
*/ */
protected function setUp() protected function setUp()
{ {
$this->localeManager = new LocaleManager();
$_SESSION[LocaleManager::class]['locale'] = 'foo_BAR'; $_SESSION[LocaleManager::class]['locale'] = 'foo_BAR';
$this->localeManager = new LocaleManager();
} }
/** /**
* Test the getSupportedLocales function. * Unset locale after each test.
* *
* @return void * @return void
*/ */
public function testConstructorWithCookies() protected function tearDown()
{ {
$localeManager = new LocaleManager([]); $this->localeManager->unsetLocale();
$this->assertEquals('foo_BAR', (string) $localeManager->getLocale());
} }
/** /**

View file

@ -77,4 +77,14 @@ class LocaleTest extends TestCase
{ {
$this->assertEquals('fr', $this->localeObject->getIso3166()); $this->assertEquals('fr', $this->localeObject->getIso3166());
} }
/**
* Test the getCountry function.
*
* @return void
*/
public function testGetCountry()
{
$this->assertEquals(country('fr'), $this->localeObject->getCountry());
}
} }