function testAddCheckout() { $title = "Three Blind Mice"; $test_book = new Book($title); $test_book->save(); $test_copy = new Copy($amount = 1, $test_book->getId()); $test_copy->save(); $name = "Joe Bongtana"; $test_patron = new Patron($name); $test_patron->save(); $due_date = "01-01-2016"; $status = 1; $test_checkout = new Checkout($test_copy->getId(), $test_patron->getId(), $due_date, $status); $test_checkout->save(); $test_patron->addCheckout($test_checkout); $result = Checkout::getAll(); $this->assertEquals($test_checkout, $result); }
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)); }
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()); }