Added orphan visits count to visits stats endpoint

This commit is contained in:
Alejandro Celaya
2021-02-08 22:44:58 +01:00
parent f7215fc2c5
commit 5278d7668c
8 changed files with 29 additions and 13 deletions

View File

@@ -51,13 +51,15 @@ class VisitsStatsHelperTest extends TestCase
public function returnsExpectedVisitsStats(int $expectedCount): void
{
$repo = $this->prophesize(VisitRepository::class);
$count = $repo->countVisits(null)->willReturn($expectedCount);
$count = $repo->countVisits(null)->willReturn($expectedCount * 3);
$countOrphan = $repo->countOrphanVisits()->willReturn($expectedCount);
$getRepo = $this->em->getRepository(Visit::class)->willReturn($repo->reveal());
$stats = $this->helper->getVisitsStats();
self::assertEquals(new VisitsStats($expectedCount), $stats);
self::assertEquals(new VisitsStats($expectedCount * 3, $expectedCount), $stats);
$count->shouldHaveBeenCalledOnce();
$countOrphan->shouldHaveBeenCalledOnce();
$getRepo->shouldHaveBeenCalledOnce();
}