public function setUp() { global $wp_rewrite; parent::setUp(); update_option('page_comments', true); update_option('comments_per_page', 5); update_option('posts_per_page', 5); $wp_rewrite->init(); $wp_rewrite->set_permalink_structure($this->structure); create_initial_taxonomies(); $wp_rewrite->flush_rules(); }
/** * Set up the test fixture. * Override wp_die(), pretend to be ajax, and suppres E_WARNINGs */ public function setUp() { parent::setUp(); // Register the core actions foreach (array_merge($this->_core_actions_get, $this->_core_actions_post) as $action) { if (function_exists('wp_ajax_' . str_replace('-', '_', $action))) { add_action('wp_ajax_' . $action, 'wp_ajax_' . str_replace('-', '_', $action), 1); } } add_filter('wp_die_ajax_handler', array($this, 'getDieHandler'), 1, 1); if (!defined('DOING_AJAX')) { define('DOING_AJAX', true); } set_current_screen('ajax'); // Clear logout cookies add_action('clear_auth_cookie', array($this, 'logout')); // Suppress warnings from "Cannot modify header information - headers already sent by" $this->_error_level = error_reporting(); error_reporting($this->_error_level & ~E_WARNING); // Make some posts $this->factory->post->create_many(5); }