1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 21:22:40 +00:00

Improve coverage slightly

Improves #66
This commit is contained in:
J. King 2018-08-17 08:35:13 -04:00
parent c7d4d8c262
commit edbfb12d17
4 changed files with 21 additions and 6 deletions

View file

@ -118,16 +118,14 @@ class Lang {
}
public function match(string $locale, array $list = null): string {
if ($list===null) {
$list = $this->listFiles();
}
$list = $list ?? $this->listFiles();
$default = ($this->locale=="") ? self::DEFAULT : $this->locale;
return \Locale::lookup($list, $locale, true, $default);
}
protected function checkRequirements(): bool {
if (!extension_loaded("intl")) {
throw new ExceptionFatal("The \"Intl\" extension is required, but not loaded");
throw new ExceptionFatal("The \"Intl\" extension is required, but not loaded"); // @codeCoverageIgnore
}
$this->requirementsMet = true;
return true;

View file

@ -67,4 +67,18 @@ class TestErrors extends \JKingWeb\Arsse\Test\AbstractTest {
$this->assertException("defaultFileMissing", "Lang");
$this->l->set("fr", true);
}
public function testLoadMissingLanguageWhenFetching() {
$this->l->set("en_ca");
unlink($this->path.TestClass::DEFAULT.".php");
$this->assertException("fileMissing", "Lang");
$this->l->msg('Test.presentText');
}
public function testLoadMissingDefaultLanguageWhenFetching() {
unlink($this->path.TestClass::DEFAULT.".php");
$this->l = new TestClass($this->path);
$this->assertException("stringMissing", "Lang");
$this->l->msg('Test.presentText');
}
}

View file

@ -6,7 +6,9 @@
declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\REST\NextCloudNews\PDO;
/** @covers \JKingWeb\Arsse\REST\NextCloudNews\V1_2<extended> */
/** @covers \JKingWeb\Arsse\REST\NextCloudNews\V1_2<extended>
* @group optional
*/
class TestV1_2 extends \JKingWeb\Arsse\TestCase\REST\NextCloudNews\TestV1_2 {
use \JKingWeb\Arsse\Test\PDOTest;
}

View file

@ -7,7 +7,8 @@ declare(strict_types=1);
namespace JKingWeb\Arsse\TestCase\REST\TinyTinyRSS\PDO;
/** @covers \JKingWeb\Arsse\REST\TinyTinyRSS\API<extended>
* @covers \JKingWeb\Arsse\REST\TinyTinyRSS\Exception */
* @covers \JKingWeb\Arsse\REST\TinyTinyRSS\Exception
* @group optional */
class TestAPI extends \JKingWeb\Arsse\TestCase\REST\TinyTinyRSS\TestAPI {
use \JKingWeb\Arsse\Test\PDOTest;
}