This commit is contained in:
Julius Haertl
2016-11-06 22:13:06 +01:00
parent c0c4010cf1
commit 1de885f488
4 changed files with 117 additions and 162 deletions

View File

@@ -27,6 +27,7 @@ use OCA\Deck\CardArchivedException;
use OCA\Deck\Controller\PageController;
use OCA\Deck\NoPermissionException;
use OCA\Deck\NotFoundException;
use OCA\Deck\StatusException;
class ExceptionsTest extends \PHPUnit_Framework_TestCase {
@@ -34,11 +35,13 @@ class ExceptionsTest extends \PHPUnit_Framework_TestCase {
$c = new \stdClass();
$e = new NoPermissionException('not allowed', $c, 'mymethod');
$this->assertEquals('stdClass#mymethod: not allowed', $e->getMessage());
$this->assertEquals(403, $e->getStatus());
}
public function testNotFoundException() {
$e = new NotFoundException('foo');
$this->assertEquals('foo', $e->getMessage());
$this->assertEquals(404, $e->getStatus());
}
public function testCardArchivedException() {
@@ -46,4 +49,10 @@ class ExceptionsTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals('foo', $e->getMessage());
}
public function testStatusException() {
$e = new StatusException('foo');
$this->assertEquals('foo', $e->getMessage());
$this->assertEquals(500, $e->getStatus());
}
}