/**
  * Test getAllRepliesInRange
  */
 public function testgetAllRepliesInRange()
 {
     $dao = new PostMySQLDAO();
     $posts = $dao->getAllRepliesInRange(23, 'twitter', 200, $from = '2006-02-28 23:50:00', $until = '2006-03-02 00:30:59', $order_by = "pub_date", $direction = "DESC");
     $this->assertEqual(sizeof($posts), 2);
     // test date ordering and time range check
     $date = strtotime($posts[0]->pub_date);
     foreach ($posts as $post) {
         $this->assertEqual($post->in_reply_to_user_id, 23);
         $this->assertTrue(strtotime($post->pub_date) >= strtotime('2000-02-28 23:50:00'));
         $this->assertTrue(strtotime($post->pub_date) < strtotime('2010-03-01 00:30:59'));
         $this->assertTrue(strtotime($post->pub_date) <= $date);
         $date = strtotime($post->pub_date);
     }
     // test ascending order
     $posts = $dao->getAllRepliesInRange(13, 'twitter', 500, $from = '2006-02-28 23:50:00', $until = '2006-03-01 00:30:59', $order_by = "pub_date", $direction = "ASC");
     $date = strtotime($posts[0]->pub_date);
     foreach ($posts as $post) {
         $this->assertTrue(strtotime($post->pub_date) >= $date);
         $date = strtotime($post->pub_date);
     }
     // test filter protected posts
     $posts = $dao->getAllRepliesInRange(13, 'twitter', 500, $from = '2006-02-28 23:50:00', $until = '2006-03-01 00:30:59', $order_by = "pub_date", $direction = "DESC", $iterator = false, $is_public = true);
     foreach ($posts as $post) {
         $this->assertEqual($post->is_protected, false);
     }
     // test range with no posts
     $posts = $dao->getAllRepliesInRange(13, 'twitter', 500, $from = '2006-02-25 23:50:00', $until = '2006-02-28 23:50:00', $order_by = "pub_date", $direction = "DESC", $iterator = false, $is_public = false);
     $this->assertEqual(sizeof($posts), 0);
     // test from greater than until
     $posts = $dao->getAllRepliesInRange(13, 'twitter', 500, $from = '2006-03-01 23:50:00', $until = '2006-02-28 23:50:00', $order_by = "pub_date", $direction = "DESC", $iterator = false, $is_public = false);
     $this->assertEqual(sizeof($posts), 0);
     $this->assertIsA($posts, 'Array');
     // test iterator
     $posts = $dao->getAllRepliesInRange(13, 'twitter', 500, $from = '2006-02-28 23:50:00', $until = '2006-03-01 00:30:59', $page = 1, $order_by = "pub_date", $direction = "ASC", $is_public = false, $iterator = true);
     $this->assertIsA($posts, 'PostIterator');
     $this->assertEqual(sizeof($posts), 1);
 }