Improved ShortUrlRepositoryTest

This commit is contained in:
Alejandro Celaya 2017-10-23 13:05:11 +02:00
parent 501a933d2e
commit 433a5a923d

View File

@ -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());
}
}