Beispiel #1
0
 function test_addCheckout()
 {
     $name = "Big Lebowski";
     $test_book = new Book($name);
     $test_book->save();
     $test_book->addCopy();
     $copies = $test_book->getCopies();
     $patron_name = "Big Lebowski";
     $test_patron = new Patron($patron_name);
     $test_patron->save();
     $test_patron->addCheckout($copies[0]);
     $result = $test_patron->getCheckouts();
     $this->assertEquals(1, count($result));
 }
Beispiel #2
0
 function testGetCheckouts()
 {
     //Arrange
     $name = "Jim Bob";
     $id = 1;
     $test_patron = new Patron($name, $id);
     $test_patron->save();
     $book_id = 1;
     $id = 1;
     $test_copy = new Copy($book_id, $id);
     $test_copy->save();
     $book_id2 = 2;
     $id2 = 2;
     $test_copy2 = new Copy($book_id2, $id2);
     $test_copy2->save();
     $copy_id = $test_copy->getId();
     $patron_id = $test_patron->getId();
     $id = null;
     $due_date = "2015-09-30";
     $test_checkout = new Checkout($copy_id, $patron_id, $due_date, $id);
     $test_checkout->save();
     // $copy_id2 = $test_copy2->getId();
     // $patron_id2 = $test_patron->getId();
     // $id2 = null;
     // $due_date2 = "2015-09-30";
     // $test_checkout2 = new Checkout($copy_id2, $patron_id2, $id2, $due_date2);
     $copy_id2 = $test_copy2->getId();
     $patron_id2 = $test_patron->getId();
     $id2 = null;
     $due_date2 = "2015-04-20";
     $test_checkout2 = new Checkout($copy_id2, $patron_id2, $due_date2, $id2);
     $test_checkout2->save();
     // var_dump($test_checkout);
     // var_dump($test_checkout2);
     //Act
     // $test_patron->addCheckout($test_checkout);
     // $test_patron->addCheckout($test_checkout2);
     $result = $test_patron->getCheckouts();
     // var_dump($result);
     //Assert
     $this->assertEquals(2, count($test_patron->getCheckouts()));
 }
Beispiel #3
0
 function test_addCheckout()
 {
     //Arrange
     $name = "Jerald the crotchety grandpa";
     $test_patron = new Patron($name);
     $test_patron->save();
     $book_id = 8;
     $test_copy = new Copy($book_id);
     $test_copy->save();
     //Act
     $test_patron->addCheckout($test_copy);
     $result = $test_patron->getCheckouts();
     //Assert
     $this->assertEquals($test_patron->getId(), $result[0]->getPatronId());
 }