From 433a5a923dcdac304b248695c896b93e67ba3426 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Mon, 23 Oct 2017 13:05:11 +0200 Subject: [PATCH] Improved ShortUrlRepositoryTest --- .../Repository/ShortUrlRepositoryTest.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/module/Core/test-func/Repository/ShortUrlRepositoryTest.php b/module/Core/test-func/Repository/ShortUrlRepositoryTest.php index 3c8688bd..4616f6c8 100644 --- a/module/Core/test-func/Repository/ShortUrlRepositoryTest.php +++ b/module/Core/test-func/Repository/ShortUrlRepositoryTest.php @@ -62,4 +62,21 @@ class ShortUrlRepositoryTest extends DatabaseTestCase $this->assertNull($this->repo->findOneByShortCode($bar->getShortCode())); $this->assertNull($this->repo->findOneByShortCode($baz->getShortCode())); } + + /** + * @test + */ + public function countListReturnsProperNumberOfResults() + { + $count = 5; + for ($i = 0; $i < $count; $i++) { + $this->getEntityManager()->persist( + (new ShortUrl())->setOriginalUrl((string) $i) + ->setShortCode((string) $i) + ); + } + $this->getEntityManager()->flush(); + + $this->assertEquals($count, $this->repo->countList()); + } }