/** @test */
 public function book_in_reservation_can_be_given_away()
 {
     $reservation = new Reservation(Uuid::uuid4(), Uuid::uuid4(), '*****@*****.**');
     $reservation->giveAway(new \DateTime('2016-01-01 00:00:00'));
     $this->assertTrue($reservation->isGivenAway());
     $this->assertEquals((new \DateTime('2016-01-01 00:00:00'))->format('Y-m-d H:i:s'), $reservation->givenAwayAt()->format('Y-m-d H:i:s'));
 }
 /** @test */
 public function it_check_if_reservation_for_book_exists_and_book_was_already_given_away()
 {
     $bookId = Uuid::uuid4();
     $reservation = new Reservation(Uuid::uuid4(), $bookId, '*****@*****.**');
     $reservation->giveAway(new \DateTime());
     $this->repository->save($reservation);
     $this->assertTrue($this->repository->existsAlreadyGivenOfBook($bookId));
 }
 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);
 }