Exemple #1
0
 function test_addCopies()
 {
     $title = "Three Blind Mice";
     $test_book = new Book($title);
     $test_book->save();
     $test_copy = new Copy($amount = 1, $test_book->getId());
     $test_copy->save();
     $title2 = "Dune";
     $test_book2 = new Book($title2);
     $test_book2->save();
     $test_copy->addCopies(1);
     $result = $test_copy->getAmount();
     $this->assertEquals(2, $result);
 }
 function testUpdate()
 {
     $book_title = "Snow Crash";
     $id = null;
     $test_book = new Book($book_title, $id);
     $test_book->save();
     $test_copy = new Copy($amount = 1, $test_book->getId());
     $test_copy->save();
     $new_amount = $amount + 1;
     $test_copy->update($new_amount);
     $this->assertEquals(2, $test_copy->getAmount());
 }