mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Test non-interactivity on DeleteExpiredShortUrlsCommand
This commit is contained in:
parent
3881996560
commit
b7db676cba
@ -13,7 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
|
|||||||
* [#2077](https://github.com/shlinkio/shlink/issues/2077) When sending visits to Matomo, the short URL title is now used as document title in matomo.
|
* [#2077](https://github.com/shlinkio/shlink/issues/2077) When sending visits to Matomo, the short URL title is now used as document title in matomo.
|
||||||
* [#2059](https://github.com/shlinkio/shlink/issues/2059) Add new `short-url:delete-expired` command that can be used to programmatically delete expired short URLs.
|
* [#2059](https://github.com/shlinkio/shlink/issues/2059) Add new `short-url:delete-expired` command that can be used to programmatically delete expired short URLs.
|
||||||
|
|
||||||
Expired short URLs are those that have a `calidUntil` date in the past, or optionally, that have reached the max amount of visits.
|
Expired short URLs are those that have a `validUntil` date in the past, or optionally, that have reached the max amount of visits.
|
||||||
|
|
||||||
This command can be run periodically by those who create many disposable URLs which are valid only for a period of time, and then can be deleted to save space.
|
This command can be run periodically by those who create many disposable URLs which are valid only for a period of time, and then can be deleted to save space.
|
||||||
|
|
||||||
|
@ -42,16 +42,17 @@ class DeleteExpiredShortUrlsCommandTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[Test]
|
#[Test]
|
||||||
#[TestWith([[], true])]
|
#[TestWith([[], [], true])]
|
||||||
#[TestWith([['--force' => true], false])]
|
#[TestWith([['--force' => true], [], false])]
|
||||||
#[TestWith([['-f' => true], false])]
|
#[TestWith([['-f' => true], [], false])]
|
||||||
public function deletionIsExecutedByDefault(array $input, bool $expectsWarning): void
|
#[TestWith([[], ['interactive' => false], false])]
|
||||||
|
public function deletionIsExecutedByDefault(array $input, array $options, bool $expectsWarning): void
|
||||||
{
|
{
|
||||||
$this->service->expects($this->never())->method('countExpiredShortUrls');
|
$this->service->expects($this->never())->method('countExpiredShortUrls');
|
||||||
$this->service->expects($this->once())->method('deleteExpiredShortUrls')->willReturn(5);
|
$this->service->expects($this->once())->method('deleteExpiredShortUrls')->willReturn(5);
|
||||||
|
|
||||||
$this->commandTester->setInputs(['y']);
|
$this->commandTester->setInputs(['y']);
|
||||||
$this->commandTester->execute($input);
|
$this->commandTester->execute($input, $options);
|
||||||
$output = $this->commandTester->getDisplay();
|
$output = $this->commandTester->getDisplay();
|
||||||
$status = $this->commandTester->getStatusCode();
|
$status = $this->commandTester->getStatusCode();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user