protected function addReservation($reservationId, $bookId, \DateTime $givenAwayAt = null) { $reservation = new Reservation(Uuid::fromString($reservationId), Uuid::fromString($bookId), '*****@*****.**'); if (null !== $givenAwayAt) { $reservation->giveAway($givenAwayAt); } $this->reservations->save($reservation); }
private function addReservation(UuidInterface $reservationId, UuidInterface $bookId, $email, \DateTime $givenAwayAt = null) { $reservation = new Reservation($reservationId, $bookId, $email); if (null !== $givenAwayAt) { $reservation->giveAway($givenAwayAt); } $this->repository->save($reservation); }
/** @test */ public function it_can_be_cleared() { $reservation1 = new Reservation(Uuid::uuid4(), Uuid::uuid4(), '*****@*****.**'); $reservation2 = new Reservation(Uuid::uuid4(), Uuid::uuid4(), '*****@*****.**'); $this->repository->save($reservation1); $this->repository->save($reservation2); $this->repository->clear(); $this->assertEmpty($this->repository->getAll()); }