2017-05-30 22:48:50 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* LocaleTest class.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Alltube\Test;
|
|
|
|
|
|
|
|
use Alltube\Locale;
|
|
|
|
|
|
|
|
/**
|
2019-04-20 22:34:12 +00:00
|
|
|
* Unit tests for the LocaleTest class.
|
2017-05-30 22:48:50 +00:00
|
|
|
*/
|
2019-04-21 16:30:02 +00:00
|
|
|
class LocaleTest extends BaseTest
|
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.
|
|
|
|
*/
|
|
|
|
protected function 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()
|
|
|
|
{
|
2017-10-26 09:02:14 +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
|
|
|
}
|