schedulerRepository = $this->createMock(SchedulerRepository::class); $this->entityManager = $this->createMock(EntityManager::class); $this->schedulerPlanner = $this->createMock(SchedulerPlanner::class); $this->exportOption = $this->createMock(ExportOption::class); $this->entityManager->expects($this->once()) ->method('getRepository') ->with(Scheduler::class) ->willReturn($this->schedulerRepository); $this->scheduleModel = new ScheduleModel($this->entityManager, $this->schedulerPlanner); } public function testGetScheduledReportsForExport(): void { $this->schedulerRepository->expects($this->once()) ->method('getScheduledReportsForExport') ->with($this->exportOption); $this->scheduleModel->getScheduledReportsForExport($this->exportOption); } public function testReportWasScheduled(): void { $report = new Report(); $this->schedulerPlanner->expects($this->once()) ->method('computeScheduler') ->with($report); $this->scheduleModel->reportWasScheduled($report); } public function testTurnOffScheduler(): void { $report = new Report(); $report->setIsScheduled(true); $this->entityManager->expects($this->once()) ->method('persist') ->with($report); $this->entityManager->expects($this->once()) ->method('flush'); $this->scheduleModel->turnOffScheduler($report); $this->assertFalse($report->isScheduled()); } }