Example #1
0
 function test_update()
 {
     //Arrange
     $name = "Bob";
     $test_author = new Author($name);
     $test_author->save();
     //Act
     $new_name = "Billy Bobby";
     $test_author->updateName($new_name);
     //Assert
     $result = Author::getAll();
     $this->assertEquals($new_name, $result[0]->getName());
 }
Example #2
0
 function test_update()
 {
     //Arrange
     $name = "David Foster Wallace";
     $test_author = new Author($name);
     $test_author->save();
     $name2 = "Roberto Bolano";
     $test_author->updateName($name2);
     $id = $test_author->getId();
     $test_author2 = new Author($name2, $id);
     //Act
     $result = Author::find($id);
     //Assert
     $this->assertEquals($test_author2, $result);
 }
Example #3
0
 function testUpdateName()
 {
     //Arrange
     $name = "Stephen King";
     $id = 1;
     $test_author = new Author($name, $id);
     $test_author->save();
     $new_name = "James Patterson";
     //Act
     $test_author->updateName($new_name);
     //Assert
     $this->assertEquals("James Patterson", $test_author->getName());
 }