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->count([])->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]); } }