/** * Setup * @todo use a term factory */ public function setUp() { parent::setUp(); foreach ($this->_terms as $term) { wp_insert_term($term, 'post_tag'); } }
/** * Set up the test fixture */ public function setUp() { parent::setUp(); $post_id = $this->factory->post->create(); $this->factory->comment->create_post_comments($post_id, 5); $this->_comment_post = get_post($post_id); }
/** * Set up the test fixture */ public function setUp() { parent::setUp(); $post_id = self::factory()->post->create(); $this->_comments = self::factory()->comment->create_post_comments($post_id, 15); $this->_comments = array_map('get_comment', $this->_comments); }
function setUp() { parent::setUp(); // Test data $this->post_count = 10; $this->post_ids = $this->factory->post->create_many($this->post_count); of_reset_options(); }
/** * Tear down the test fixture. */ public function tearDown() { // Cleanup foreach ($this->_ids as $id) { wp_delete_attachment($id, true); } parent::tearDown(); }
/** * Set up the test fixture */ public function setUp() { parent::setUp(); $post_id = $this->factory->post->create(); $this->factory->comment->create_post_comments($post_id, 5); $this->_comment_post = get_post($post_id); $post_id = $this->factory->post->create(array('post_status' => 'draft')); $this->_draft_post = get_post($post_id); }
/** * Set up the test fixture. */ public function setUp() { parent::setUp(); require_once ABSPATH . WPINC . '/class-wp-customize-manager.php'; wp_set_current_user(self::factory()->user->create(array('role' => 'administrator'))); global $wp_customize; $this->wp_customize = new WP_Customize_Manager(); $wp_customize = $this->wp_customize; }
function tearDown() { $this->plugin->customize_concurrency->customize_manager = null; unset($GLOBALS['wp_customize']); unset($GLOBALS['wp_scripts']); unset($_REQUEST['wp_customize']); unset($_SERVER['REQUEST_METHOD']); parent::tearDown(); }
/** * Set up the test fixture */ public function setUp() { parent::setUp(); // Set a user so the $post has 'post_author' $this->user_id = self::factory()->user->create(array('role' => 'administrator')); wp_set_current_user($this->user_id); $post_id = self::factory()->post->create(array('post_status' => 'draft')); $this->_post = get_post($post_id); }
/** * Set up the test fixture */ public function setUp() { parent::setUp(); $post_id = self::factory()->post->create(); self::factory()->comment->create_post_comments($post_id, 5); $this->_comment_post = get_post($post_id); $post_id = self::factory()->post->create(); $this->_no_comment_post = get_post($post_id); unset($GLOBALS['post_id']); }
function tearDown() { $GLOBALS['wp_theme_directories'] = $this->orig_theme_dir; remove_filter('theme_root', array($this, 'filter_theme_root')); remove_filter('stylesheet_root', array($this, 'filter_theme_root')); remove_filter('template_root', array($this, 'filter_theme_root')); wp_clean_themes_cache(); unset($GLOBALS['wp_themes']); parent::tearDown(); }
/** * Tear down the test fixture. */ public function tearDown() { // Cleanup foreach ($this->_ids as $id){ wp_delete_attachment($id, true); } $uploads = wp_upload_dir(); foreach ( scandir( $uploads['basedir'] ) as $file ) _rmdir( $uploads['basedir'] . '/' . $file ); parent::tearDown(); }
function setUp() { parent::setUp(); $this->author_id = self::factory()->user->create(array('role' => 'administrator')); wp_set_current_user($this->author_id); $this->slash_1 = 'String with 1 slash \\'; $this->slash_2 = 'String with 2 slashes \\\\'; $this->slash_3 = 'String with 3 slashes \\\\\\'; $this->slash_4 = 'String with 4 slashes \\\\\\\\'; $this->slash_5 = 'String with 5 slashes \\\\\\\\\\'; $this->slash_6 = 'String with 6 slashes \\\\\\\\\\\\'; $this->slash_7 = 'String with 7 slashes \\\\\\\\\\\\\\'; }
function setUp() { parent::setUp(); FrmAppController::install(); $this->import_xml(); $this->factory->form = new Form_Factory($this); $this->factory->field = new Field_Factory($this); $this->factory->entry = new Entry_Factory($this); $this->is_pro_active = FrmAppHelper::pro_is_installed(); $current_class_name = get_class($this); if (strpos($current_class_name, 'FrmPro') && !$this->is_pro_active) { $this->markTestSkipped('Pro is not active'); } }
public function setUp() { // Add new custom cap add_filter('custom_caps', function ($caps) { $caps[] = 'create_post_tag_terms'; return $caps; }); // Track metadata changes add_filter('update_user_metadata', function ($true, $object_id, $meta_key, $meta_value, $prev_value) { $this->updated_usermeta[$object_id][$meta_key] = $meta_value; return $true; }, 10, 5); parent::setUp(); $this->user = get_user_by('id', $this->factory->user->create(array('role' => 'administrator'))); wp_set_current_user($this->user->ID); $_POST = array_merge((array) $_POST, array('action' => 'heartbeat', 'custom-caps-update-nonce' => wp_create_nonce('custom-caps-update'), '_wp_http_referer' => get_admin_url())); $_REQUEST = array_merge($_POST, $_GET); }
function setUp() { parent::setUp(); $settings = get_option('pmp_settings'); if (empty($settings['pmp_api_url']) || empty($settings['pmp_client_id']) || empty($settings['pmp_client_secret'])) { $this->skip = true; } else { $this->skip = false; $this->sdk_wrapper = new SDKWrapper(); // A test query that's all but guaranteed to return at least one result. $this->query = array('text' => 'Obama', 'limit' => 10, 'profile' => 'story'); $this->editor = $this->factory->user->create(); $user = get_user_by('id', $this->editor); $user->set_role('editor'); wp_set_current_user($user->ID); $this->group = array('attributes' => array('title' => 'WP PMP Unit Test Group ' . time())); $this->collection = array('attributes' => array('title' => 'WP PMP Unit Test Collection ' . time())); } }
/** * Set up a test case. * * @see WP_UnitTestCase::setup() */ public function setUp() { parent::setUp(); }
function setUp() { parent::setUp(); remove_filter('sanitize_option_optionsframework', 'optionsframework_validate'); remove_filter('sanitize_option_' . get_option('stylesheet'), 'optionsframework_validate'); update_option('optionsframework', array("id" => get_option('stylesheet'), "knownoptions" => array(get_option('stylesheet')))); $this->previous_options = array('social_icons_display' => 'both', 'in_series' => NULL, 'show_tags' => 1, 'show_author_box' => 1, 'show_related_content' => 1, 'show_next_prev_nav_single' => 1, 'largo_version' => NULL); update_option(get_option('stylesheet'), $this->previous_options); }
function setUp() { parent::setUp(); $this->post = $this->factory->post->create(); $this->attachment = $this->factory->post->create(array('post_type' => 'attachment')); $this->gallery = $this->factory->post->create_many(5, array('post_type' => 'attachment')); $this->media_types = array('image' => array('id' => $this->post, 'attachment' => $this->attachment, 'type' => 'image')); }
/** * Tear down. */ function tearDown() { $this->plugin->customize_snapshot_manager->customize_manager = null; $this->manager = null; unset($GLOBALS['wp_customize']); unset($GLOBALS['wp_scripts']); unset($_SERVER['REQUEST_METHOD']); unset($_REQUEST['wp_customize']); unset($_REQUEST['customize_snapshot_uuid']); unset($_REQUEST['preview']); parent::tearDown(); }
function tearDown() { wp_set_current_user($this->old_current_user); parent::tearDown(); }
function setUp() { parent::setUp(); of_reset_options(); }
function tearDown() { parent::tearDown(); m::close(); cmb2_update_option(WP_Gistpen::$plugin_name, '_wpgp_gist_token', false); }
/** * Set up the test fixture */ public function setUp() { parent::setUp(); // Set a user so the $post has 'post_author' wp_set_current_user(self::$admin_id); }
public function tearDown() { remove_filter('query', array($this, '_block_comments')); parent::tearDown(); }
public function setUp() { parent::setUp(); $this->__post_id = $this->factory->post->create(array('post_title' => 'Dynamic Featured Image WordPress Plugin')); }
/** * Tear down the test fixture. */ public function tearDown() { wp_set_current_user(0); parent::tearDown(); }
/** * Tear down the test fixture. */ public function tearDown() { // Cleanup $this->remove_added_uploads(); parent::tearDown(); }
function setUp() { parent::setUp(); remove_all_actions('wp_head'); }
function setUp() { parent::setUp(); // Test data $this->avatar_id = $this->factory->post->create(array('post_type' => 'attachment')); $this->user_id = $this->factory->user->create(); }