示例#1
0
 function testGetBookId()
 {
     $book_id = 1;
     $test_copy = new Copy($book_id);
     $result = $test_copy->getBookId();
     $this->assertEquals($book_id, $result);
 }
示例#2
0
 function test_getBookId()
 {
     //Arrange
     $available = true;
     $book_id = 1;
     $test_copy = new Copy($available, $book_id);
     //Act
     $result = $test_copy->getBookId();
     //Assert
     $this->assertEquals($book_id, $result);
 }
示例#3
0
 function test_addCopies()
 {
     //Arrange
     $book_name = "Slaughterhouse-5";
     $test_book = new Book($book_name);
     $test_book->save();
     //Act
     $test_book->addCopies(1);
     $test_copy = new Copy($test_book->getId());
     $result = Copy::getAll();
     //Assert
     $this->assertEquals($test_copy->getBookId(), $result[0]->getBookId());
 }
示例#4
0
 function testUpdateBookId()
 {
     //Arrange
     $book_id = 1;
     $test_copy = new Copy($book_id);
     $test_copy->save();
     $new_book_id = 3;
     //Act
     $test_copy->updateBookId($new_book_id);
     //Assert
     $this->assertEquals($test_copy->getBookId(), $new_book_id);
 }