Improve some console commands coverage

This commit is contained in:
Alejandro Celaya
2025-11-18 08:41:42 +01:00
parent f3ff059d48
commit 933c54e884
3 changed files with 41 additions and 0 deletions

View File

@@ -64,6 +64,21 @@ class CreateShortUrlCommandTest extends TestCase
self::assertStringNotContainsString('but the real-time updates cannot', $output);
}
#[Test]
public function longUrlIsAskedIfNotProvided(): void
{
$shortUrl = ShortUrl::createFake();
$this->urlShortener->expects($this->once())->method('shorten')->withAnyParameters()->willReturn(
UrlShorteningResult::withoutErrorOnEventDispatching($shortUrl),
);
$this->stringifier->expects($this->once())->method('stringify')->with($shortUrl)->willReturn(
'stringified_short_url',
);
$this->commandTester->setInputs([$shortUrl->getLongUrl()]);
$this->commandTester->execute([]);
}
#[Test]
public function providingNonUniqueSlugOutputsError(): void
{