/**
  * Test getRepliesToPostInRange
  */
 public function testgetRepliesToPostInRange()
 {
     $dao = new PostMySQLDAO();
     // Default Sorting
     $posts = $dao->getRepliesToPostInRange('41', 'twitter', $from = '2006-03-01 00:00:00', $until = '2006-03-02 23:30:59', $order_by = "pub_date");
     $this->assertEqual(sizeof($posts), 2);
     $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[1]->post_id, '132', "post ID");
     // test date ordering and time range check
     $date = strtotime($posts[0]->pub_date);
     foreach ($posts as $post) {
         $this->assertEqual($post->in_reply_to_post_id, 41);
         $this->assertTrue(strtotime($post->pub_date) >= strtotime('2006-03-01 00:00:00'));
         $this->assertTrue(strtotime($post->pub_date) < strtotime('2006-03-03 00:30:59'));
         $this->assertTrue(strtotime($post->pub_date) <= $date);
         $date = strtotime($post->pub_date);
     }
     // test ascending order
     $posts = $dao->getRepliesToPostInRange(41, 'twitter', $from = '2006-03-01 00:00:00', $until = '2006-03-02 00:30:59', $order_by = "pub_date", $direction = "ASC", $iterator = false, $is_public = false);
     $date = strtotime($posts[0]->pub_date);
     foreach ($posts as $post) {
         $this->assertTrue(strtotime($post->pub_date) >= $date);
         $date = strtotime($post->pub_date);
     }
     // test range with no posts
     $posts = $dao->getRepliesToPostInRange(41, 'twitter', $from = '1970-01-02 00:00:00', $until = '1971-01-02 00:59:59', $order_by = "pub_date");
     $this->assertEqual(sizeof($posts), 0);
     // test from greater than until
     $posts = $dao->getRepliesToPostInRange(41, 'twitter', $from = '2007-01-02 00:00:00', $until = '2006-01-02 00:59:59', $order_by = "pub_date");
     $this->assertEqual(sizeof($posts), 0);
 }