function testGetPatrons() { //Arrange $due_date = "2015-10-10"; $book_id = 1; $id = 1; $test_copy = new Copy($due_date, $book_id, $id); $test_copy->save(); $name = "Jim Bob"; $id = 1; $test_patron = new Patron($name, $id); $test_patron->save(); $name2 = "Sally Sue"; $id2 = 2; $test_patron2 = new Patron($name, $id); $test_patron2->save(); //Act $test_copy->addPatron($test_patron); $test_copy->addPatron($test_patron2); $result = $test_copy->getPatrons(); //Assert $this->assertEquals([$test_patron, $test_patron2], $result); }
function testGetPatron() { //Arrange $book_id = 1; $id = 1; $test_copy = new Copy($book_id, $id); $test_copy->save(); $name = "Ping Pong"; $id2 = 1; $test_patron = new Patron($name, $id2); $test_patron->save(); $name2 = "Ding Dong"; $id3 = 2; $test_patron2 = new Patron($name2, $id3); $test_patron2->save(); //Act $test_copy->addPatron($test_patron->getId()); $test_copy->addPatron($test_patron2->getId()); //Assert $this->assertEquals($test_copy->getPatron(), [$test_patron, $test_patron2]); }