1
0
Fork 0
mirror of https://codeberg.org/demostf/api.git synced 2026-06-03 09:54:17 +02:00

proper error response for not found demos

This commit is contained in:
Robin Appelman 2020-12-09 22:47:28 +01:00
commit 202d11fcc9
7 changed files with 61 additions and 9 deletions

View file

@ -10,6 +10,7 @@ use Demostf\API\Demo\Demo;
use Demostf\API\Demo\DemoStore;
use Demostf\API\Error\InvalidHashException;
use Demostf\API\Error\InvalidKeyException;
use Demostf\API\Error\NotFoundException;
use Demostf\API\Providers\ChatProvider;
use Demostf\API\Providers\DemoListProvider;
use Demostf\API\Providers\DemoProvider;
@ -228,4 +229,17 @@ class DemoControllerTest extends ControllerTest {
$controller->listDemos();
$this->assertResponseData(['dummy']);
}
public function testGetNotFound() {
$controller = $this->getController();
$this->demoProvider->expects($this->once())
->method('get')
->with(1)
->willReturn(null);
$this->expectException(NotFoundException::class);
$controller->get('1');
}
}