From 0952c488be5689551961bebff1b93d6ec5bcae46 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 11 Dec 2022 18:33:40 +0100 Subject: [PATCH] Added exclusion flags to ListShortUrlsCommand --- .../CLI/src/Command/ShortUrl/ListShortUrlsCommand.php | 6 ++++-- module/CLI/test-cli/Command/ListShortUrlsTest.php | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/module/CLI/src/Command/ShortUrl/ListShortUrlsCommand.php b/module/CLI/src/Command/ShortUrl/ListShortUrlsCommand.php index 86a9dd57..6e735221 100644 --- a/module/CLI/src/Command/ShortUrl/ListShortUrlsCommand.php +++ b/module/CLI/src/Command/ShortUrl/ListShortUrlsCommand.php @@ -79,13 +79,13 @@ class ListShortUrlsCommand extends Command ) ->addOption( 'exclude-max-visits-reached', - null, // TODO + null, InputOption::VALUE_NONE, 'Excludes short URLs which reached their max amount of visits.', ) ->addOption( 'exclude-past-valid-until', - null, // TODO + null, InputOption::VALUE_NONE, 'Excludes short URLs which have a "validUntil" date in the past.', ) @@ -145,6 +145,8 @@ class ListShortUrlsCommand extends Command ShortUrlsParamsInputFilter::ORDER_BY => $orderBy, ShortUrlsParamsInputFilter::START_DATE => $startDate?->toAtomString(), ShortUrlsParamsInputFilter::END_DATE => $endDate?->toAtomString(), + ShortUrlsParamsInputFilter::EXCLUDE_MAX_VISITS_REACHED => $input->getOption('exclude-max-visits-reached'), + ShortUrlsParamsInputFilter::EXCLUDE_PAST_VALID_UNTIL => $input->getOption('exclude-past-valid-until'), ]; if ($all) { diff --git a/module/CLI/test-cli/Command/ListShortUrlsTest.php b/module/CLI/test-cli/Command/ListShortUrlsTest.php index faa47a2f..c98573a5 100644 --- a/module/CLI/test-cli/Command/ListShortUrlsTest.php +++ b/module/CLI/test-cli/Command/ListShortUrlsTest.php @@ -61,6 +61,16 @@ class ListShortUrlsTest extends CliTestCase | custom-with-domain | | http://some-domain.com/custom-with-domain | https://google.com | 2018-10-20T00:00:00+00:00 | 0 | +--------------------+-------+-------------------------------------------+----------------------------- Page 1 of 1 -----------------------------------------------------------+---------------------------+--------------+ OUTPUT]; + yield 'expired excluded' => [['--exclude-max-visits-reached', '--exclude-past-valid-until'], <<