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

@@ -45,6 +45,19 @@ class ResolveUrlCommandTest extends TestCase
self::assertEquals('Long URL: ' . $expectedUrl . PHP_EOL, $output);
}
#[Test]
public function shortCodeIsAskedIfNotProvided(): void
{
$shortCode = 'abc123';
$shortUrl = ShortUrl::createFake();
$this->urlResolver->expects($this->once())->method('resolveShortUrl')->with(
ShortUrlIdentifier::fromShortCodeAndDomain($shortCode),
)->willReturn($shortUrl);
$this->commandTester->setInputs([$shortCode]);
$this->commandTester->execute([]);
}
#[Test]
public function incorrectShortCodeOutputsErrorMessage(): void
{