| @@ 35-45 (lines=11) @@ | ||
| 32 | /** |
|
| 33 | * @test |
|
| 34 | */ |
|
| 35 | public function properListReturnsSuccessResponse() |
|
| 36 | { |
|
| 37 | $page = 3; |
|
| 38 | $this->service->listShortUrls($page, null, [], null)->willReturn(new Paginator(new ArrayAdapter())) |
|
| 39 | ->shouldBeCalledTimes(1); |
|
| 40 | ||
| 41 | $response = $this->action->handle(ServerRequestFactory::fromGlobals()->withQueryParams([ |
|
| 42 | 'page' => $page, |
|
| 43 | ])); |
|
| 44 | $this->assertEquals(200, $response->getStatusCode()); |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * @test |
|
| @@ 50-60 (lines=11) @@ | ||
| 47 | /** |
|
| 48 | * @test |
|
| 49 | */ |
|
| 50 | public function anExceptionsReturnsErrorResponse() |
|
| 51 | { |
|
| 52 | $page = 3; |
|
| 53 | $this->service->listShortUrls($page, null, [], null)->willThrow(\Exception::class) |
|
| 54 | ->shouldBeCalledTimes(1); |
|
| 55 | ||
| 56 | $response = $this->action->handle(ServerRequestFactory::fromGlobals()->withQueryParams([ |
|
| 57 | 'page' => $page, |
|
| 58 | ])); |
|
| 59 | $this->assertEquals(500, $response->getStatusCode()); |
|
| 60 | } |
|
| 61 | } |
|
| 62 | ||