em = $this->prophesize(EntityManagerInterface::class); $this->helper = new VisitsStatsHelper($this->em->reveal()); } /** * @test * @dataProvider provideCounts */ public function returnsExpectedVisitsStats(int $expectedCount): void { $repo = $this->prophesize(VisitRepository::class); $count = $repo->countVisits(null)->willReturn($expectedCount); $getRepo = $this->em->getRepository(Visit::class)->willReturn($repo->reveal()); $stats = $this->helper->getVisitsStats(); self::assertEquals(new VisitsStats($expectedCount), $stats); $count->shouldHaveBeenCalledOnce(); $getRepo->shouldHaveBeenCalledOnce(); } public function provideCounts(): iterable { return map(range(0, 50, 5), fn (int $value) => [$value]); } }