/** @test */
 function a_book_has_a_title_and_authors()
 {
     $id = BookId::generate();
     $book = new AvailableBook($id, "Domain-driven design", "Eric J. Evans", 1599, "0534408133", "www.blabla.jpg", false);
     $this->assertEquals($book->getId(), (string) $id);
     $this->assertEquals($book->bookId(), $id);
     $this->assertEquals($book->title(), "Domain-driven design");
     $this->assertEquals($book->author(), "Eric J. Evans");
     $this->assertEquals($book->price(), 1599);
     $this->assertEquals($book->isbn(), "0534408133");
     $this->assertEquals($book->pathToCover(), "www.blabla.jpg");
     $this->assertEquals($book->salePending(), false);
 }
 public function whenBookSaleCancelled(BookSaleCancelled $event)
 {
     $book = $this->books->find((string) $event->bookId());
     $book = new AvailableBook($book->bookId(), $book->title(), $book->author(), $book->price(), $book->isbn(), $book->pathToCover(), false);
     $this->books->save($book);
 }