Example #1
0
 /**
  * Check to see if the specification is satisfied
  *
  * @param Isbn $isbn
  * @param $organization
  * @return bool
  */
 public function isSatisfiedBy(Isbn $isbn, $organization = null)
 {
     if (!$organization instanceof Organization) {
         throw new \InvalidArgumentException($organization . ' must be of type Organization');
     }
     if (!$this->repository->bookOfIsbn($organization, $isbn)) {
         return true;
     }
     return false;
 }
 /**
  * @test
  * @group bookrepo
  */
 public function should_return_null_when_book_of_isbn_not_found()
 {
     $isbn = new Isbn('9788879116190');
     $klimtoren = $this->getKlimtoren();
     $book = $this->bookRepo->bookOfIsbn($klimtoren, $isbn);
     $this->assertNull($book);
 }
Example #3
0
 /**
  * Find a book by it's isbn
  *
  * @param $orgId
  * @param $isbn
  * @return Book|null
  * @throws OrganizationNotFoundException
  */
 public function bookOfIsbn($orgId, $isbn)
 {
     $isbn = new Isbn($isbn);
     $organization = $this->orgRepo->organizationOfId($orgId);
     if (!$organization) {
         throw new OrganizationNotFoundException($orgId);
     }
     $book = $this->bookRepo->bookOfIsbn($organization, $isbn);
     return $book;
 }