/**
  * Test getAllMentionsIterator
  */
 public function testGetAllMentionsIterator()
 {
     $dao = new PostMySQLDAO();
     $mentions = $dao->getAllMentions("ev", 10, 'twitter');
     $mentions_it = $dao->getAllMentionsIterator("ev", 10, 'twitter');
     $cnt = 0;
     foreach ($mentions_it as $key => $value) {
         $this->assertEqual($value->post_text, $mentions[$cnt]->post_text);
         $cnt++;
     }
     $this->assertEqual($cnt, 10);
     $mentions = $dao->getAllMentions("jack", 10, 'twitter');
     $mentions_it = $dao->getAllMentionsIterator("jack", 10, 'twitter');
     $cnt = 0;
     foreach ($mentions_it as $key => $value) {
         $this->assertEqual($value->post_text, $mentions[$cnt]->post_text);
         $cnt++;
     }
     $this->assertEqual($cnt, 10);
     // test paging
     $mentions = $dao->getAllMentionsIterator("ev", $count = 1, 'twitter', $page = 1);
     $mentions->valid();
     $this->assertEqual($mentions->current()->post_text, "Hey @ev and @jack should fix Twitter - post 9");
     $mentions = $dao->getAllMentionsIterator("ev", $count = 1, 'twitter', $page = 2);
     $mentions->valid();
     $this->assertEqual($mentions->current()->post_text, "Hey @ev and @jack should fix Twitter - post 8");
     $mentions = $dao->getAllMentionsIterator("ev", $count = 1, 'twitter', $page = 3);
     $mentions->valid();
     $this->assertEqual($mentions->current()->post_text, "Hey @ev and @jack should fix Twitter - post 7");
     // insert a retweet
     $builders[] = FixtureBuilder::build('posts', array('author_user_id' => 20, 'author_username' => 'user1', 'author_fullname' => 'User 1', 'in_reply_to_post_id' => null, 'in_retweet_of_post_id' => 121, 'is_geo_encoded' => 0, 'network' => 'twitter', 'old_retweet_count_cache' => 0, 'in_rt_of_user_id' => 13, 'post_text' => 'Hey @ev and @jack thanks for founding Twitter retweet 1', 'pub_date' => '2006-03-01 00:01:00', 'location' => 'New Delhi'));
     // test count and no retweets
     $mentions = $dao->getAllMentionsIterator("ev", $count = 10, 'twitter', $page = 1, $public = false, $include_rts = false);
     $count = 0;
     foreach ($mentions as $mention) {
         $this->assertEqual($mention->in_retweet_of_post_id, null);
         $count++;
     }
     $this->assertEqual($count, 10);
     // test default order_by
     $mentions = $dao->getAllMentionsIterator("ev", $count = 1, 'twitter', $page = 1, false, true, "';-- SELECT");
     $mentions->valid();
     $this->assertEqual($mentions->current()->post_text, "Hey @ev and @jack should fix Twitter - post 9");
 }
 /**
  * Test getAllMentionsIterator
  */
 public function testGetAllMentionsIterator()
 {
     $dao = new PostMySQLDAO();
     $mentions = $dao->getAllMentions("ev", 10, 'twitter');
     $mentions_it = $dao->getAllMentionsIterator("ev", 10, 'twitter');
     $cnt = 0;
     foreach ($mentions_it as $key => $value) {
         $this->assertEqual($value->post_text, $mentions[$cnt]->post_text);
         $cnt++;
     }
     $this->assertEqual($cnt, 10);
     $mentions = $dao->getAllMentions("jack", 10, 'twitter');
     $mentions_it = $dao->getAllMentionsIterator("jack", 10, 'twitter');
     $cnt = 0;
     foreach ($mentions_it as $key => $value) {
         $this->assertEqual($value->post_text, $mentions[$cnt]->post_text);
         $cnt++;
     }
     $this->assertEqual($cnt, 10);
 }