Convert DeleteShortUrlVisitsCommand into invokable command

This commit is contained in:
Alejandro Celaya
2025-12-15 10:04:43 +01:00
parent 36cb760a88
commit d481c06f09
4 changed files with 55 additions and 29 deletions

View File

@@ -36,7 +36,7 @@ class DeleteShortUrlVisitsCommandTest extends TestCase
$this->deleter->expects($this->never())->method('deleteShortUrlVisits');
$this->commandTester->setInputs($input);
$exitCode = $this->commandTester->execute(['shortCode' => 'foo']);
$exitCode = $this->commandTester->execute(['short-code' => 'foo']);
$output = $this->commandTester->getDisplay();
self::assertEquals(Command::SUCCESS, $exitCode);
@@ -67,8 +67,8 @@ class DeleteShortUrlVisitsCommandTest extends TestCase
public static function provideErrorArgs(): iterable
{
yield 'domain' => [['shortCode' => 'foo'], 'Short URL not found for "foo"'];
yield 'no domain' => [['shortCode' => 'foo', '--domain' => 's.test'], 'Short URL not found for "s.test/foo"'];
yield 'domain' => [['short-code' => 'foo'], 'Short URL not found for "foo"'];
yield 'no domain' => [['short-code' => 'foo', '--domain' => 's.test'], 'Short URL not found for "s.test/foo"'];
}
#[Test]
@@ -77,7 +77,7 @@ class DeleteShortUrlVisitsCommandTest extends TestCase
$this->deleter->expects($this->once())->method('deleteShortUrlVisits')->willReturn(new BulkDeleteResult(5));
$this->commandTester->setInputs(['yes']);
$exitCode = $this->commandTester->execute(['shortCode' => 'foo']);
$exitCode = $this->commandTester->execute(['short-code' => 'foo']);
$output = $this->commandTester->getDisplay();
self::assertEquals(Command::SUCCESS, $exitCode);