/** * Test getRepliesToPost */ function testGetRepliesToPost() { $dao = new PostMySQLDAO(); $posts = $dao->getRepliesToPost(41); $this->assertEqual(sizeof($posts), 3); $this->assertEqual($posts[0]->post_text, '@shutterbug Nice shot!', "post reply"); $this->assertEqual($posts[0]->author->username, 'user1', "Post author"); $this->assertEqual($posts[2]->post_text, '@shutterbug This is a link post reply http://example.com/', "post reply"); $this->assertEqual($posts[2]->post_id, 133, "post ID"); $this->assertEqual($posts[2]->author->username, 'linkbaiter', "Post author"); $this->assertEqual($posts[2]->link->expanded_url, 'http://example.com/expanded-link.html', "Expanded URL"); }
public function testGetRepliesToFacebookPagePost() { //Facebook page posts are a special case, because the users have their network set to 'facebook', but the post //network is 'facebook page' $dao = new PostMySQLDAO(); $builders = $this->buildFacebookPagePostAndReplies(); $posts = $dao->getRepliesToPost(145, 'facebook page'); $this->assertEqual(sizeof($posts), 2); $this->assertEqual($posts[0]->post_text, '@ev Cool!', "post reply"); $this->assertEqual($posts[1]->post_text, '@ev Rock on!', "post reply"); }
/** * Test getRepliesToPost */ public function testGetRepliesToPost() { $dao = new PostMySQLDAO(); // Default Sorting $posts = $dao->getRepliesToPost(41, 'twitter'); $this->assertEqual(sizeof($posts), 3); $this->assertEqual($posts[0]->post_text, '@shutterbug Nice shot!', "post reply"); $this->assertEqual($posts[0]->author->username, 'user1', "Post author"); $this->assertEqual($posts[0]->location, 'New Delhi, Delhi, India'); $this->assertEqual($posts[1]->location, 'Chennai, Tamil Nadu, India'); $this->assertEqual($posts[2]->post_text, '@shutterbug This is a link post reply http://example.com/', "post reply"); $this->assertEqual($posts[2]->post_id, 133, "post ID"); $this->assertEqual($posts[2]->author->username, 'linkbaiter', "Post author"); $this->assertEqual($posts[2]->link->expanded_url, 'http://example.com/expanded-link.html', "Expanded URL"); $this->assertEqual($posts[2]->location, 'Mumbai, Maharashtra, India'); // Sorting By Proximity $posts = $dao->getRepliesToPost(41, 'twitter', 'location'); $this->assertEqual(sizeof($posts), 3); $this->assertEqual($posts[0]->post_text, '@shutterbug Nice shot!', "post reply"); $this->assertEqual($posts[0]->author->username, 'user1', "Post author"); $this->assertEqual($posts[0]->location, 'New Delhi, Delhi, India'); $this->assertEqual($posts[1]->location, 'Mumbai, Maharashtra, India'); $this->assertEqual($posts[1]->post_text, '@shutterbug This is a link post reply http://example.com/', "post reply"); $this->assertEqual($posts[1]->post_id, 133, "post ID"); $this->assertEqual($posts[1]->author->username, 'linkbaiter', "Post author"); $this->assertEqual($posts[1]->link->expanded_url, 'http://example.com/expanded-link.html', "Expanded URL"); $this->assertEqual($posts[2]->location, 'Chennai, Tamil Nadu, India'); }