Inheritance: extends WP_UnitTestCase
 function setUp()
 {
     parent::setUp();
     update_option('show_on_front', 'page');
     update_option('page_for_posts', self::factory()->post->create(array('post_title' => 'blog-page', 'post_type' => 'page')));
     update_option('page_on_front', self::factory()->post->create(array('post_title' => 'front-page', 'post_type' => 'page')));
 }
 function setUp()
 {
     parent::setUp();
     $this->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
     create_initial_taxonomies();
     $this->http = set_url_scheme(home_url('sample-page/'), 'http');
     $this->https = set_url_scheme(home_url('sample-page/'), 'https');
 }
示例#3
0
文件: noRewrite.php 项目: nkeat12/dv
 public function setUp()
 {
     global $wp_rewrite;
     parent::setUp();
     $wp_rewrite->init();
     $wp_rewrite->set_permalink_structure('');
     $wp_rewrite->flush_rules();
 }
 function setUp()
 {
     parent::setUp();
     global $wp_rewrite;
     // Add a custom Rewrite rule to test category redirections.
     $wp_rewrite->add_rule('ccr/(.+?)/sort/(asc|desc)', 'index.php?category_name=$matches[1]&order=$matches[2]', 'top');
     // ccr = Custom_Cat_Rule
     $wp_rewrite->flush_rules();
 }
示例#5
0
 function tearDown()
 {
     global $wp_rewrite;
     $wp_rewrite->init();
     parent::tearDown();
 }
 /**
  * Clean up shared fixtures.
  *
  * @since 4.1.0
  */
 public static function delete_shared_fixtures()
 {
     self::delete_user(self::$author_id);
     foreach (self::$post_ids as $pid) {
         wp_delete_post($pid, true);
     }
     foreach (self::$comment_ids as $cid) {
         wp_delete_comment($cid, true);
     }
     foreach (self::$term_ids as $tid => $tax) {
         wp_delete_term($tid, $tax);
     }
     self::$author_id = null;
     self::$post_ids = array();
     self::$comment_ids = array();
     self::$term_ids = array();
     self::$terms = array();
 }
示例#7
0
 /**
  * Clean up shared fixtures.
  *
  * @since 4.1.0
  */
 public static function delete_shared_fixtures()
 {
     self::$author_id = null;
     self::$post_ids = array();
     self::$comment_ids = array();
     self::$term_ids = array();
     self::$terms = array();
 }
示例#8
0
 /**
  * Clean up shared fixtures.
  *
  * @since 4.1.0
  */
 public static function delete_shared_fixtures()
 {
     global $wp_rewrite;
     if (is_multisite()) {
         wpmu_delete_user(self::$author_id);
     } else {
         wp_delete_user(self::$author_id);
     }
     foreach (self::$post_ids as $pid) {
         wp_delete_post($pid, true);
     }
     foreach (self::$comment_ids as $cid) {
         wp_delete_comment($cid, true);
     }
     foreach (self::$term_ids as $tid => $tax) {
         wp_delete_term($tid, $tax);
     }
     self::$author_id = null;
     self::$post_ids = array();
     self::$comment_ids = array();
     self::$term_ids = array();
     self::$terms = array();
     self::commit_transaction();
 }
示例#9
0
 public function setUp()
 {
     parent::setUp();
     wp_set_current_user(self::$author_id);
 }
示例#10
0
 public function tearDown()
 {
     wp_set_current_user(self::$old_current_user);
     parent::tearDown();
 }