1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-23 17:12:41 +00:00
Arsse/tests/Lang/TestLangErrors.php

64 lines
1.7 KiB
PHP
Raw Normal View History

2017-02-11 17:11:14 +00:00
<?php
declare(strict_types=1);
2017-03-28 04:12:12 +00:00
namespace JKingWeb\Arsse;
use org\bovigo\vfs\vfsStream;
2017-02-11 17:11:14 +00:00
class TestLangErrors extends \PHPUnit\Framework\TestCase {
2017-02-16 20:29:42 +00:00
use Test\Tools, Test\Lang\Setup;
public $files;
public $path;
public $l;
2017-02-16 20:29:42 +00:00
function setUpSeries() {
$this->l->set("", true);
2017-02-16 20:29:42 +00:00
}
function testLoadEmptyFile() {
$this->assertException("fileCorrupt", "Lang");
$this->l->set("fr_ca", true);
2017-02-16 20:29:42 +00:00
}
function testLoadFileWhichDoesNotReturnAnArray() {
$this->assertException("fileCorrupt", "Lang");
$this->l->set("it", true);
2017-02-16 20:29:42 +00:00
}
function testLoadFileWhichIsNotPhp() {
$this->assertException("fileCorrupt", "Lang");
$this->l->set("ko", true);
2017-02-16 20:29:42 +00:00
}
function testLoadFileWhichIsCorrupt() {
$this->assertException("fileCorrupt", "Lang");
$this->l->set("zh", true);
2017-02-16 20:29:42 +00:00
}
function testLoadFileWithooutReadPermission() {
$this->assertException("fileUnreadable", "Lang");
$this->l->set("ru", true);
2017-02-16 20:29:42 +00:00
}
function testLoadSubtagOfMissingLanguage() {
$this->assertException("fileMissing", "Lang");
$this->l->set("pt_br", true);
2017-02-16 20:29:42 +00:00
}
function testFetchInvalidMessage() {
$this->assertException("stringInvalid", "Lang");
$this->l->set("vi", true);
$txt = $this->l->msg('Test.presentText');
}
function testFetchMissingMessage() {
$this->assertException("stringMissing", "Lang");
$txt = $this->l->msg('Test.absentText');
}
2017-02-16 20:29:42 +00:00
function testLoadMissingDefaultLanguage() {
unlink($this->path.Lang::DEFAULT.".php");
2017-02-16 20:29:42 +00:00
$this->assertException("defaultFileMissing", "Lang");
$this->l->set("fr", true);
2017-02-16 20:29:42 +00:00
}
2017-02-11 17:11:14 +00:00
}