1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 21:22:40 +00:00
Arsse/tests/TestException.php
2017-02-14 22:34:08 -05:00

70 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
namespace JKingWeb\NewsSync;
class TestException extends \PHPUnit\Framework\TestCase {
use Test\Tools;
static function setUpBeforeClass() {
Lang::set("");
}
static function tearDownAfterClass() {
Lang::set(Lang::DEFAULT);
}
function testBaseClass() {
$this->assertException("unknown");
throw new Exception("unknown");
}
/**
* @depends testBaseClass
*/
function testBaseClassWithoutMessage() {
$this->assertException("unknown");
throw new Exception();
}
/**
* @depends testBaseClass
*/
function testDerivedClass() {
$this->assertException("fileMissing", "Lang");
throw new Lang\Exception("fileMissing");
}
/**
* @depends testDerivedClass
*/
function testDerivedClassWithMessageParameters() {
$this->assertException("fileMissing", "Lang");
throw new Lang\Exception("fileMissing", "en");
}
/**
* @depends testBaseClass
*/
function testBaseClassWithUnknownCode() {
$this->assertException("uncoded");
throw new Exception("testThisExceptionMessageDoesNotExist");
}
/**
* @depends testBaseClass
*/
function testBaseClassWithMissingMessage() {
$this->assertException("stringMissing", "Lang");
throw new Exception("invalid");
}
/**
* @depends testBaseClassWithUnknownCode
*/
function testDerivedClassWithMissingMessage() {
$this->assertException("uncoded");
throw new Lang\Exception("testThisExceptionMessageDoesNotExist");
}
}