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