function test_filter_c2c_admin_post_navigation_orderby() { add_filter('c2c_admin_post_navigation_orderby', array($this, 'c2c_admin_post_navigation_orderby'), 10, 2); $posts = $this->create_posts(); // Change post dates so post ordering by date is 3, 0, 2, 4, 1 $new_post_dates = array('2015-06-13 12:30:00', '2015-03-13 12:30:00', '2015-05-13 12:30:00', '2015-07-13 12:30:00', '2015-04-13 12:30:00'); foreach ($new_post_dates as $i => $date) { $post = get_post($posts[$i]); $post->post_date = $date; wp_update_post($post); } $next_post = c2c_AdminPostNavigation::next_post(); $this->assertEquals($posts[0], $next_post->ID); $previous_post = c2c_AdminPostNavigation::previous_post(); $this->assertEquals($posts[4], $previous_post->ID); }