/** * Test if lesson comments are retrieved for registered users. */ public function testLessonCommentsQueryRegistered() { global $wp_the_query; $tmp = $wp_the_query; // Add a comment. wp_insert_comment(array('comment_post_ID' => $this->lessons[2], 'comment_author' => 'admin', 'comment_author_email' => '*****@*****.**', 'comment_approved' => 1, 'comment_date' => current_time('mysql'), 'comment_content' => 'lesson comment content', 'comment_author_IP' => '127.0.0.1', 'comment_type' => '')); Edr_PostTypes::clear_current_user_courses(); $wp_the_query = new WP_Query(); $wp_the_query->query(array('feed' => 'rss2', 'post_type' => 'ib_educator_lesson', 'name' => 'course-3-lesson-1')); $this->assertEquals(1, $wp_the_query->comment_count); $wp_the_query = $tmp; }