2013-10-21 22:46:31 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Sabre\DAV;
|
|
|
|
|
|
|
|
class ExceptionTest extends \PHPUnit_Framework_TestCase {
|
|
|
|
|
|
|
|
function testStatus() {
|
|
|
|
|
|
|
|
$e = new Exception();
|
2016-05-28 15:46:24 +00:00
|
|
|
$this->assertEquals(500, $e->getHTTPCode());
|
2013-10-21 22:46:31 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function testExceptionStatuses() {
|
|
|
|
|
2016-05-28 15:46:24 +00:00
|
|
|
$c = [
|
2013-10-21 22:46:31 +00:00
|
|
|
'Sabre\\DAV\\Exception\\NotAuthenticated' => 401,
|
|
|
|
'Sabre\\DAV\\Exception\\InsufficientStorage' => 507,
|
2016-05-28 15:46:24 +00:00
|
|
|
];
|
2013-10-21 22:46:31 +00:00
|
|
|
|
2016-05-28 15:46:24 +00:00
|
|
|
foreach ($c as $class => $status) {
|
2013-10-21 22:46:31 +00:00
|
|
|
|
|
|
|
$obj = new $class();
|
|
|
|
$this->assertEquals($status, $obj->getHTTPCode());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|