Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. <?php
  2.  
  3. class SampleTest extends WP_UnitTestCase {
  4.  
  5. protected function setup_postdata()
  6. {
  7. global $post;
  8. global $wp_query;
  9.  
  10. $wp_query->is_singular = true;
  11.  
  12. $post_id = $this->factory->post->create( array(
  13. 'post_title' => 'Hello',
  14. 'post_author' => 1,
  15. 'post_status' => 'publish',
  16. 'post_date' => '2014-01-01 00:00:00',
  17. ) );
  18. $post = get_post( $post_id );
  19. setup_postdata( $post );
  20. }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement