Beispiel #1
0
 function testDelete()
 {
     //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();
     //Act
     $test_patron->addCopy($test_copy);
     $test_patron->delete();
     //Assert
     $this->assertEquals([], $test_copy->getPatrons());
 }
Beispiel #2
0
 function testGetCopy()
 {
     //Arrange
     $copy_id = 1;
     $test_copy = new Copy($copy_id);
     $test_copy->save();
     $copy_id2 = 2;
     $id2 = 2;
     $test_copy2 = new Copy($copy_id2);
     $test_copy2->save();
     $name = "Ping Pong";
     $id2 = 1;
     $test_patron = new Patron($name);
     $test_patron->save();
     //Act
     $test_patron->addCopy($test_copy->getId());
     $test_patron->addCopy($test_copy2->getId());
     //Assert
     $this->assertEquals($test_patron->getCopy(), [$test_copy, $test_copy2]);
 }