More test coverage
Run youtube-dl with --restrict-filenames in order to avoid issues when testing against different locales
This commit is contained in:
parent
419110f764
commit
0a66dce2b8
7 changed files with 190 additions and 29 deletions
65
tests/LocaleManagerTest.php
Normal file
65
tests/LocaleManagerTest.php
Normal file
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
/**
|
||||
* LocaleManagerTest class.
|
||||
*/
|
||||
|
||||
namespace Alltube\Test;
|
||||
|
||||
use Alltube\Locale;
|
||||
use Alltube\LocaleManager;
|
||||
|
||||
/**
|
||||
* Unit tests for the Config class.
|
||||
*/
|
||||
class LocaleManagerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* LocaleManager class instance.
|
||||
*
|
||||
* @var LocaleManager
|
||||
*/
|
||||
private $localeManager;
|
||||
|
||||
/**
|
||||
* Prepare tests.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->localeManager = new LocaleManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the getSupportedLocales function.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetSupportedLocales()
|
||||
{
|
||||
foreach ($this->localeManager->getSupportedLocales() as $locale) {
|
||||
$this->assertInstanceOf(Locale::class, $locale);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the getLocale function.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGetLocale()
|
||||
{
|
||||
$this->assertNull($this->localeManager->getLocale());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the setLocale function.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testSetLocale()
|
||||
{
|
||||
$this->localeManager->setLocale(new Locale('foo_BAR'));
|
||||
$locale = $this->localeManager->getLocale();
|
||||
$this->assertInstanceOf(Locale::class, $locale);
|
||||
$this->assertEquals('foo_BAR', (string) $locale);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue