mirror of
https://codeberg.org/demostf/api.git
synced 2026-06-03 18:04:08 +02:00
proper error response for not found demos
This commit is contained in:
parent
6ccf387d1e
commit
202d11fcc9
7 changed files with 61 additions and 9 deletions
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue