entityManager = self::getContainer()->get(EntityManagerInterface::class); } public function testCountByPerosn(): void { $person = $this->getRandomPerson($this->entityManager); $periodRepository = $this->prophesize(AccompanyingPeriodACLAwareRepositoryInterface::class); $periodRepository->findByPerson($person, AccompanyingPeriodVoter::SEE)->willReturn([]); $calendarRepository = new CalendarACLAwareRepository( $periodRepository->reveal(), $this->entityManager ); $count = $calendarRepository->countByPerson($person, new \DateTimeImmutable('yesterday'), new \DateTimeImmutable('tomorrow')); $this->assertIsInt($count); } /** * Test that the query does not throw any error. */ public function testFindByPerson(): void { $person = $this->getRandomPerson($this->entityManager); $periodRepository = $this->prophesize(AccompanyingPeriodACLAwareRepositoryInterface::class); $periodRepository->findByPerson($person, AccompanyingPeriodVoter::SEE)->willReturn([]); $calendarRepository = new CalendarACLAwareRepository( $periodRepository->reveal(), $this->entityManager ); $calendars = $calendarRepository->findByPerson($person, null, null, ['startDate' => 'ASC'], 10, 1); $this->assertIsArray($calendars); } }