|
@@ 49-58 (lines=10) @@
|
| 46 |
|
/** |
| 47 |
|
* @test |
| 48 |
|
*/ |
| 49 |
|
public function providingInvalidShortCodeReturnsError() |
| 50 |
|
{ |
| 51 |
|
$shortCode = 'abc123'; |
| 52 |
|
$this->visitsTracker->info($shortCode, Argument::type(DateRange::class))->willThrow( |
| 53 |
|
InvalidArgumentException::class |
| 54 |
|
)->shouldBeCalledTimes(1); |
| 55 |
|
|
| 56 |
|
$response = $this->action->handle(ServerRequestFactory::fromGlobals()->withAttribute('shortCode', $shortCode)); |
| 57 |
|
$this->assertEquals(404, $response->getStatusCode()); |
| 58 |
|
} |
| 59 |
|
|
| 60 |
|
/** |
| 61 |
|
* @test |
|
@@ 63-72 (lines=10) @@
|
| 60 |
|
/** |
| 61 |
|
* @test |
| 62 |
|
*/ |
| 63 |
|
public function unexpectedExceptionWillReturnError() |
| 64 |
|
{ |
| 65 |
|
$shortCode = 'abc123'; |
| 66 |
|
$this->visitsTracker->info($shortCode, Argument::type(DateRange::class))->willThrow( |
| 67 |
|
\Exception::class |
| 68 |
|
)->shouldBeCalledTimes(1); |
| 69 |
|
|
| 70 |
|
$response = $this->action->handle(ServerRequestFactory::fromGlobals()->withAttribute('shortCode', $shortCode)); |
| 71 |
|
$this->assertEquals(500, $response->getStatusCode()); |
| 72 |
|
} |
| 73 |
|
|
| 74 |
|
/** |
| 75 |
|
* @test |