From 5f9b62967673f19ebb7914c5326c5581588f9e6d Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Tue, 14 Jul 2020 13:28:38 +0200 Subject: [PATCH] Added test for short URLs with all items --- .../ShortUrl/ListShortUrlsCommandTest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/module/CLI/test/Command/ShortUrl/ListShortUrlsCommandTest.php b/module/CLI/test/Command/ShortUrl/ListShortUrlsCommandTest.php index 2e315581..d8bc0f60 100644 --- a/module/CLI/test/Command/ShortUrl/ListShortUrlsCommandTest.php +++ b/module/CLI/test/Command/ShortUrl/ListShortUrlsCommandTest.php @@ -192,4 +192,22 @@ class ListShortUrlsCommandTest extends TestCase yield [['--orderBy' => 'foo,ASC'], ['foo' => 'ASC']]; yield [['--orderBy' => 'bar,DESC'], ['bar' => 'DESC']]; } + + /** @test */ + public function requestingAllElementsWillSetItemsPerPage(): void + { + $listShortUrls = $this->shortUrlService->listShortUrls(ShortUrlsParams::fromRawData([ + 'page' => 1, + 'searchTerm' => null, + 'tags' => [], + 'startDate' => null, + 'endDate' => null, + 'orderBy' => null, + 'itemsPerPage' => -1, + ]))->willReturn(new Paginator(new ArrayAdapter())); + + $this->commandTester->execute(['--all' => true]); + + $listShortUrls->shouldHaveBeenCalledOnce(); + } }