public function testDeleteHashtagsPostsByHashtagId() { $this->debug("Begin testDeleteHashtagsPostsByHashtagId"); $this->hashtagpost_dao->insertHashtagPost('exist_yet', '39089424330978176', 'twitter'); $this->hashtagpost_dao->insertHashtagPost('exist_yet', '39089424330978177', 'twitter'); $this->hashtagpost_dao->insertHashtagPost('exist_yet', '39089424330978178', 'twitter'); $this->hashtagpost_dao->insertHashtagPost('exist_yet', '39089424330978179', 'twitter'); $res = $this->hashtagpost_dao->getHashtagPostsByHashtagID(1); $this->assertEqual(sizeof($res), 4); $res = $this->hashtagpost_dao->deleteHashtagsPostsByHashtagID(1); $res = $this->hashtagpost_dao->getHashtagPostsByHashtagID(1); $this->assertEqual(sizeof($res), 0); $this->debug("End testDeleteHashtagsPostsByHashtagId"); }
/** * This method tests basic handling of the data structures generated by the json parser, including entity and * user information. In add'n, it tests new-style rt handling. */ public function testAddPostAndAssociatedInfo() { list($post, $entities, $user_array) = $this->buildStreamPostArray1(); $dao = new PostMySQLDAO(); $dao->addPostAndAssociatedInfo($post, $entities, $user_array); $post_orig = $dao->getPost('39088587140108288', 'twitter'); $this->assertEqual($post_orig->post_text, '@joanwalsh RT @AntDeRosa Hillary #Clinton provides perhaps the best argument defending Planned ' . 'Parenthood (Video, 2009) http://j.mp/eZbWh0'); $this->assertEqual($post_orig->post_id, '39088587140108288'); $this->assertEqual($post_orig->retweet_count_cache, 1); $this->assertEqual($post_orig->old_retweet_count_cache, 0); $this->assertEqual($post_orig->in_retweet_of_post_id, null); $post_rt = $dao->getPost('39089424620978176', 'twitter'); $this->assertEqual($post_rt->post_id, '39089424620978176'); $this->assertEqual($post_rt->post_text, 'RT @HeyJacquiDey: @joanwalsh RT @AntDeRosa ' . 'Hillary #Clinton provides perhaps the best argument defending Planned Parenthood (Video, 2009) ...'); $this->assertEqual($post_rt->retweet_count_cache, 0); $this->assertEqual($post_rt->old_retweet_count_cache, 0); $this->assertEqual($post_rt->in_retweet_of_post_id, '39088587140108288'); $this->assertEqual($post_rt->in_rt_of_user_id, '136881432'); $hashtag_dao = new HashtagMySQLDAO(); $hashtagpost_dao = new HashtagPostMySQLDAO(); $m_dao = new MentionMySQLDAO(); $h = $hashtag_dao->getHashtag('Clinton', 'twitter'); $this->assertEqual($h->count_cache, 2); $hp = $hashtagpost_dao->getHashtagsForPost('39088587140108288', 'twitter'); $this->assertEqual(sizeof($hp), 1); $this->assertEqual($hp[0]['post_id'], '39088587140108288'); $hp = $hashtagpost_dao->getHashtagsForPost('39089424620978176', 'twitter'); $this->assertEqual($hp[0]['post_id'], '39089424620978176'); $this->assertEqual($hp[0]['hashtag_id'], 3); $hph = $hashtagpost_dao->getHashtagPostsByHashtagID(3); $this->assertEqual(sizeof($hph), 2); $this->assertEqual($hph[1]['post_id'], '39089424620978176'); $m = $m_dao->getMentionInfoUserName('joanwalsh'); $this->assertEqual($m['count_cache'], 2); $mp = $m_dao->getMentionsForPost('39089424620978176'); $this->assertEqual(sizeof($mp), 3); $this->assertEqual($mp[1]['mention_id'], 2); $mpm = $m_dao->getMentionsForPostMID(2); $this->assertEqual(sizeof($mpm), 2); $this->assertEqual($mpm[0]['post_id'], '39088587140108288'); }