|
@@ 41-52 (lines=12) @@
|
| 38 |
|
/** |
| 39 |
|
* @test |
| 40 |
|
*/ |
| 41 |
|
public function successMessageIsPrintedIfUrlIsProperlyDeleted() |
| 42 |
|
{ |
| 43 |
|
$shortCode = 'abc123'; |
| 44 |
|
$deleteByShortCode = $this->service->deleteByShortCode($shortCode, false)->will(function () { |
| 45 |
|
}); |
| 46 |
|
|
| 47 |
|
$this->commandTester->execute(['shortCode' => $shortCode]); |
| 48 |
|
$output = $this->commandTester->getDisplay(); |
| 49 |
|
|
| 50 |
|
$this->assertContains(\sprintf('Short URL with short code "%s" successfully deleted.', $shortCode), $output); |
| 51 |
|
$deleteByShortCode->shouldHaveBeenCalledTimes(1); |
| 52 |
|
} |
| 53 |
|
|
| 54 |
|
/** |
| 55 |
|
* @test |
|
@@ 57-69 (lines=13) @@
|
| 54 |
|
/** |
| 55 |
|
* @test |
| 56 |
|
*/ |
| 57 |
|
public function invalidShortCodePrintsMessage() |
| 58 |
|
{ |
| 59 |
|
$shortCode = 'abc123'; |
| 60 |
|
$deleteByShortCode = $this->service->deleteByShortCode($shortCode, false)->willThrow( |
| 61 |
|
Exception\InvalidShortCodeException::class |
| 62 |
|
); |
| 63 |
|
|
| 64 |
|
$this->commandTester->execute(['shortCode' => $shortCode]); |
| 65 |
|
$output = $this->commandTester->getDisplay(); |
| 66 |
|
|
| 67 |
|
$this->assertContains(\sprintf('Provided short code "%s" could not be found.', $shortCode), $output); |
| 68 |
|
$deleteByShortCode->shouldHaveBeenCalledTimes(1); |
| 69 |
|
} |
| 70 |
|
|
| 71 |
|
/** |
| 72 |
|
* @test |