2017-05-30 22:48:50 +00:00
|
|
|
<?php
|
2019-10-03 19:24:12 +00:00
|
|
|
|
2017-05-30 22:48:50 +00:00
|
|
|
/**
|
|
|
|
* LocaleTest class.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Alltube\Test;
|
|
|
|
|
2020-10-22 20:39:09 +00:00
|
|
|
use Alltube\Exception\ConfigException;
|
|
|
|
use Alltube\Exception\DependencyException;
|
2017-05-30 22:48:50 +00:00
|
|
|
use Alltube\Locale;
|
2020-10-22 20:39:09 +00:00
|
|
|
use SmartyException;
|
2017-05-30 22:48:50 +00:00
|
|
|
|
|
|
|
/**
|
2019-04-20 22:34:12 +00:00
|
|
|
* Unit tests for the LocaleTest class.
|
2017-05-30 22:48:50 +00:00
|
|
|
*/
|
2020-10-22 20:39:09 +00:00
|
|
|
class LocaleTest extends ContainerTest
|
2017-05-30 22:48:50 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Locale class instance.
|
|
|
|
*
|
|
|
|
* @var Locale
|
|
|
|
*/
|
2017-10-26 09:02:14 +00:00
|
|
|
private $localeObject;
|
2017-05-30 22:48:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Prepare tests.
|
2020-10-22 20:39:09 +00:00
|
|
|
*
|
|
|
|
* @throws DependencyException
|
|
|
|
* @throws ConfigException
|
|
|
|
* @throws SmartyException
|
2017-05-30 22:48:50 +00:00
|
|
|
*/
|
2019-11-30 13:08:18 +00:00
|
|
|
protected function setUp(): void
|
2017-05-30 22:48:50 +00:00
|
|
|
{
|
2020-10-22 20:39:09 +00:00
|
|
|
parent::setUp();
|
|
|
|
|
2017-10-26 09:02:14 +00:00
|
|
|
$this->localeObject = new Locale('fr_FR');
|
2017-05-30 22:48:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test the __toString function.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testGetToString()
|
|
|
|
{
|
2017-10-26 09:02:14 +00:00
|
|
|
$this->assertEquals('fr_FR', $this->localeObject->__toString());
|
2017-05-30 22:48:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test the getFullName function.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testGetFullName()
|
|
|
|
{
|
2023-03-21 19:25:47 +00:00
|
|
|
$this->assertEquals('Français (France)', $this->localeObject->getFullName());
|
2017-05-30 22:48:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test the getIso15897 function.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testGetIso15897()
|
|
|
|
{
|
2017-10-26 09:02:14 +00:00
|
|
|
$this->assertEquals('fr_FR', $this->localeObject->getIso15897());
|
2017-05-30 22:48:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test the getBcp47 function.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testGetBcp47()
|
|
|
|
{
|
2017-10-26 09:02:14 +00:00
|
|
|
$this->assertEquals('fr-FR', $this->localeObject->getBcp47());
|
2017-05-30 22:48:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test the getIso3166 function.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testGetIso3166()
|
|
|
|
{
|
2017-10-26 09:02:14 +00:00
|
|
|
$this->assertEquals('fr', $this->localeObject->getIso3166());
|
2017-05-30 22:48:50 +00:00
|
|
|
}
|
2019-04-20 10:17:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Test the getCountry function.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function testGetCountry()
|
|
|
|
{
|
|
|
|
$this->assertEquals(country('fr'), $this->localeObject->getCountry());
|
|
|
|
}
|
2017-05-30 22:48:50 +00:00
|
|
|
}
|