/** * @test */ public function validateReturnsEmptyResultForValidParticipant() { $participant = new Person(); /** @var Reservation $mockReservation */ $mockReservation = $this->getMock(Reservation::class); $participant->setReservation($mockReservation); $expectedResult = new Result(); $this->assertEquals($expectedResult, $this->subject->validate($participant)); }
/** * action createParticipant * * @param Reservation $reservation * @param Person $newParticipant * @return void */ public function createParticipantAction(Reservation $reservation, Person $newParticipant) { if (!$reservation->getStatus() == Reservation::STATUS_DRAFT) { $reservation->setStatus(Reservation::STATUS_DRAFT); } $newParticipant->setType(Person::PERSON_TYPE_PARTICIPANT); $reservation->getLesson()->addParticipant($newParticipant); $reservation->addParticipant($newParticipant); $this->reservationRepository->update($reservation); $this->persistenceManager->persistAll(); $this->addFlashMessage($this->translate('message.reservation.createParticipant.success')); $this->redirect('edit', null, null, ['reservation' => $reservation]); }
/** * @return Person */ protected function mockParticipant() { $participant = new Person(); $reservation = new Reservation(); $participant->setReservation($reservation); return $participant; }