Beispiel #1
0
 public function testUpdatePostText()
 {
     $dao = new PostMySQLDAO();
     $post = $dao->getPost(10, 'twitter');
     $this->assertEqual($post->post_text, "This is post 10");
     // bad id
     $update_cnt = $dao->updatePostText(-99, 'twitter', 'updated post text');
     $this->assertEqual($update_cnt, 0);
     // bad network
     $update_cnt = $dao->updatePostText(10, 'no-net', 'updated post text');
     $this->assertEqual($update_cnt, 0);
     // good id
     $update_cnt = $dao->updatePostText(10, 'twitter', 'This is updated post 10');
     $this->assertEqual($update_cnt, 1);
     $post = $dao->getPost(10, 'twitter');
     $this->assertEqual($post->post_text, 'This is updated post 10');
 }