コード例 #1
0
ファイル: PatronTest.php プロジェクト: r-hills/library-1
 function test_getCurrentCheckouts()
 {
     //Arrange
     // create 2 test patrons.
     $name = "Suzie Palloozi";
     $phone = "1-800-439-0398";
     $test_patron = new Patron($name, $phone);
     $test_patron->save();
     $name2 = "Tac Zoltani";
     $phone2 = "1-800-407-3930";
     $test_patron2 = new Patron($name2, $phone2);
     $test_patron2->save();
     // create 2 test checkouts. hard code copy_id for now
     $copy_id = 1;
     $due_date = "2015-03-04";
     $test_checkout = new Checkout($copy_id, $test_patron2->getId(), $due_date);
     $test_checkout->save();
     // initialize one checkout as returned to make sure that getCurrentCheckouts
     // only gets current checkouts and not just all of them
     $copy_id2 = 2;
     $due_date2 = "2011-03-04";
     $returned = true;
     $test_checkout2 = new Checkout($copy_id2, $test_patron2->getId(), $due_date2, $returned);
     $test_checkout2->save();
     //Act
     $result = $test_patron2->getCurrentCheckouts();
     //Assert
     $this->assertEquals([$test_checkout], $result);
 }