setUp() public method

Override wp_die(), pretend to be ajax, and suppres E_WARNINGs
public setUp ( )
Ejemplo n.º 1
0
 /**
  * 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);
 }
Ejemplo n.º 2
0
 /**
  * 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);
 }
Ejemplo n.º 3
0
 /**
  * Setup
  * @todo use a term factory
  */
 public function setUp()
 {
     parent::setUp();
     foreach ($this->_terms as $term) {
         wp_insert_term($term, 'post_tag');
     }
 }
Ejemplo n.º 4
0
 function setUp()
 {
     parent::setUp();
     // Test data
     $this->post_count = 10;
     $this->post_ids = $this->factory->post->create_many($this->post_count);
     of_reset_options();
 }
 /**
  * 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;
 }
 /**
  * Set up the test fixture.
  */
 public function setUp()
 {
     parent::setUp();
     remove_all_actions('wp_ajax_customize_save');
     remove_all_actions('wp_ajax_customize_update_snapshot');
     $this->plugin = new Plugin();
     $this->set_input_vars();
     $this->plugin->init();
 }
Ejemplo n.º 7
0
 /**
  * Set up the test fixture
  */
 public function setUp()
 {
     parent::setUp();
     // Set a user so the $post has 'post_author'
     $this->user_id = $this->factory->user->create(array('role' => 'administrator'));
     wp_set_current_user($this->user_id);
     $post_id = $this->factory->post->create(array('post_status' => 'draft'));
     $this->_post = get_post($post_id);
 }
Ejemplo n.º 8
0
 /**
  * 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);
 }
Ejemplo n.º 9
0
 /**
  * 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']);
 }
 /**
  * Set up the test fixture.
  */
 public function setUp()
 {
     parent::setUp();
     $this->plugin = get_plugin_instance();
     require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
     $GLOBALS['wp_customize'] = new \WP_Customize_Manager();
     $this->plugin->customize_concurrency->customize_manager = $GLOBALS['wp_customize'];
     wp_set_current_user($this->factory->user->create(array('role' => 'administrator')));
     $_SERVER['REQUEST_METHOD'] = 'POST';
     $_REQUEST['wp_customize'] = 'on';
 }
 function setUp()
 {
     parent::setUp();
     $this->theme_root = DIR_TESTDATA . '/themedir1';
     $this->orig_theme_dir = $GLOBALS['wp_theme_directories'];
     // /themes is necessary as theme.php functions assume /themes is the root if there is only one root.
     $GLOBALS['wp_theme_directories'] = array(WP_CONTENT_DIR . '/themes', $this->theme_root);
     add_filter('theme_root', array($this, 'filter_theme_root'));
     add_filter('stylesheet_root', array($this, 'filter_theme_root'));
     add_filter('template_root', array($this, 'filter_theme_root'));
     wp_clean_themes_cache();
     unset($GLOBALS['wp_themes']);
 }
Ejemplo n.º 12
0
 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');
     }
 }
Ejemplo n.º 14
0
 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);
 }
Ejemplo n.º 15
0
 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()));
     }
 }
Ejemplo n.º 16
0
 function setUp()
 {
     parent::setUp();
     $this->factory = new WP_Gistpen_UnitTest_Factory();
     // Mock models
     $this->mock_lang = m::mock('WP_Gistpen\\Model\\Language');
     $this->mock_zip = m::mock('WP_Gistpen\\Model\\Zip');
     $this->mock_file = m::mock('WP_Gistpen\\Model\\File');
     $this->mock_history = m::mock('WP_Gistpen\\Collection\\History');
     $this->mock_commit = m::mock('WP_Gistpen\\Model\\Commit\\Meta');
     $this->mock_state = m::mock('WP_Gistpen\\Model\\Commit\\State');
     // Mock controllers
     $this->mock_sync = m::mock('WP_Gistpen\\Controller\\Sync');
     // Mock adapters
     $this->mock_gist_adapter = m::mock('WP_Gistpen\\Adapter\\Gist');
     // Mock Facades
     $this->mock_database = m::mock('WP_Gistpen\\Facade\\Database');
     $this->mock_adapter = m::mock('WP_Gistpen\\Facade\\Adapter');
     // 3rd Party dependencies
     $this->mock_github_client = m::mock('Github\\Client');
 }
Ejemplo n.º 17
0
	/**
	 * Set up the test fixture.
	 */
	public function setUp() {
		parent::setUp();
	}
Ejemplo n.º 18
0
 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);
 }
Ejemplo n.º 19
0
 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'));
 }
Ejemplo n.º 20
0
 /**
  * Set up the test fixture.
  */
 public function setUp()
 {
     parent::setUp();
     require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
 }
Ejemplo n.º 21
0
 function setUp()
 {
     parent::setUp();
     of_reset_options();
 }
 function setUp()
 {
     parent::setUp();
     new WebPush_Admin();
 }
 public function setUp()
 {
     parent::setUp();
     $this->__post_id = $this->factory->post->create(array('post_title' => 'Dynamic Featured Image WordPress Plugin'));
 }
Ejemplo n.º 24
0
 /**
  * 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);
 }
Ejemplo n.º 25
0
 function setUp()
 {
     parent::setUp();
     remove_all_actions('wp_head');
 }
Ejemplo n.º 26
0
 function setUp()
 {
     parent::setUp();
     // Test data
     $this->avatar_id = $this->factory->post->create(array('post_type' => 'attachment'));
     $this->user_id = $this->factory->user->create();
 }