Exemple #1
0
 function testGetPatronId()
 {
     $due_date = "2015-09-10";
     $copy_id = 1;
     $patron_id = 1;
     $checkin_status = 1;
     $test_checkout = new Checkout($due_date, $copy_id, $patron_id, $checkin_status);
     $result = $test_checkout->getPatronId();
     $this->assertEquals($patron_id, $result);
 }
 function testGetPatronId()
 {
     $patron_name = "Eduardo";
     $patron_id = 1;
     $test_patron = new Patron($patron_name, $patron_id);
     $test_patron->save();
     $copy_id = 1;
     $due_date = "2015-01-01";
     $checkout_status = false;
     $test_checkout = new Checkout($patron_id, $copy_id, $due_date, $checkout_status);
     $result = $test_checkout->getPatronId();
     $this->assertEquals(1, $result);
 }
 function test_getPatronId()
 {
     // for now, feed a dummy copy_id just for testing
     // later, we will need to use getNextCopy() in Book class
     // to get a copy for a given book
     //Arrange
     // Make a Patron
     $name = "Dan Brown";
     $phone = "3";
     $email = "*****@*****.**";
     $test_patron = new Patron($name, $phone, $email);
     // Make a Checkout
     $patron_id = $test_patron->getId();
     $copy_id = 1;
     $date = "2015-08-09";
     $test_checkout = new Checkout($patron_id, $copy_id, $date);
     //Act
     $result = $test_checkout->getPatronId();
     //Assert
     $this->assertEquals($patron_id, $result);
 }
Exemple #4
0
 function test_updatePatronId()
 {
     //Arrange
     // Make a Patron
     $name = "Dan Brown";
     $phone = "3";
     $email = "*****@*****.**";
     $test_patron = new Patron($name, $phone, $email);
     $test_patron->save();
     // Make a Checkout and save
     $patron_id = $test_patron->getId();
     $copy_id = 1;
     $due_date = "2015-08-09";
     $test_checkout = new Checkout($patron_id, $copy_id, $due_date);
     $test_checkout->save();
     //Make a second Patron
     $name2 = "Vaughn Brown";
     $phone2 = "4";
     $email2 = "*****@*****.**";
     $test_patron2 = new Patron($name2, $phone2, $email2);
     $test_patron2->save();
     $new_patron_id = $test_patron2->getId();
     //Act
     $test_checkout->updatePatronId($new_patron_id);
     //Assert
     $result = $test_checkout->getPatronId();
     $this->assertEquals($new_patron_id, $result);
 }