setUp() публичный Метод

public setUp ( )
Пример #1
0
 function setUp()
 {
     parent::setUp();
     $this->container = new Container();
     $this->container->object('pluginMeta', array())->packager('cliPackager', 'Arrow\\Twig\\CliPackager');
     $this->packager = $this->container->lookup('cliPackager');
 }
Пример #2
0
 function setUp()
 {
     parent::setUp();
     create_initial_taxonomies();
     $this->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
     $this->home_url = get_option('home');
 }
Пример #3
0
 public function setUp()
 {
     if (!extension_loaded('openssl')) {
         $this->markTestSkipped('Tests_HTTP_Functions requires openssl.');
     }
     parent::setUp();
 }
 public function setUp()
 {
     parent::setUp();
     $this->author_id = self::factory()->user->create(array('role' => 'editor'));
     // Override the post/archive slug collision prevention in `wp_unique_post_slug()`.
     add_filter('wp_unique_post_slug', array($this, 'filter_unique_post_slug'), 10, 6);
 }
Пример #5
0
 function setUp()
 {
     parent::setUp();
     global $wp_rewrite;
     $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
     $wp_rewrite->flush_rules();
 }
 public function setUp()
 {
     parent::setUp();
     $this->client = $this->getMockBuilder('\\AudioTheme_Agent_Client')->setMethods(array('deauthorize', 'refresh_access_token', 'wp_remote_request'))->getMock();
     add_option(AudioTheme_Agent_Client::CLIENT_OPTION_NAME, array('client_id' => '123456789', 'client_secret' => '987654321'));
     add_option(AudioTheme_Agent_Client::TOKEN_OPTION_NAME, array('access_token' => 'abcdef', 'refresh_token' => 'zyxwvu', 'expires_at' => time() + 300, 'token_type' => 'bearer'));
 }
 public function setUp()
 {
     //save the hooks state before WP_UnitTestCase actually gets its hands on it...
     //as it immediately adds a few hooks we might not want to backup
     global $auto_made_thing_seed, $wp_filter, $wp_actions, $merged_filters, $wp_current_filter, $wpdb, $current_user;
     $this->wp_filters_saved = array('wp_filter' => $wp_filter, 'wp_actions' => $wp_actions, 'merged_filters' => $merged_filters, 'wp_current_filter' => $wp_current_filter);
     $this->_orig_current_user = clone $current_user;
     parent::setUp();
     EE_Registry::reset(TRUE);
     $auto_made_thing_seed = 1;
     //reset wpdb's list of queries executed so it only stores those from the current test
     $wpdb->queries = array();
     //the accidental txn commit indicator option shouldn't be set from the previous test
     update_option('accidental_txn_commit_indicator', TRUE);
     //		$this->wp_actions_saved = $wp_actions;
     // Fake WP mail globals, to avoid errors
     add_filter('wp_mail', array($this, 'setUp_wp_mail'));
     add_filter('wp_mail_from', array($this, 'tearDown_wp_mail'));
     add_filter('FHEE__EEH_Activation__create_table__short_circuit', '__return_true');
     add_filter('FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', '__return_true');
     add_filter('FHEE__EEH_Activation__drop_index__short_circuit', '__return_true');
     // load factories
     EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_TESTS_DIR . 'includes' . DS . 'factories');
     $this->factory = new EE_UnitTest_Factory();
     // load scenarios
     require_once EE_TESTS_DIR . 'includes/scenarios/EE_Test_Scenario_Classes.php';
     $this->scenarios = new EE_Test_Scenario_Factory($this);
     EE_Registry::reset();
 }
Пример #8
0
 function setUp()
 {
     parent::setUp();
     $this->post_type = rand_str(12);
     register_post_type($this->post_type);
     $this->q = new WP_Query();
 }
 function setUp()
 {
     parent::setUp();
     if (!file_exists(WP_CONTENT_DIR . '/backups')) {
         mkdir(WP_CONTENT_DIR . '/backups', 0777);
     }
 }
 public function setUp()
 {
     global $wpdb;
     parent::setUp();
     $this->suppress = $wpdb->suppress_errors();
     update_site_option('upload_space_check_disabled', false);
 }
Пример #11
0
 function setUp()
 {
     global $wp_rewrite;
     parent::setUp();
     set_current_screen('front');
     $GLOBALS['wp_the_query'] = new WP_Query();
     $GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
     $wp_rewrite->init();
     $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
     create_initial_taxonomies();
     register_taxonomy('testtax', 'post', array('public' => true));
     $wp_rewrite->flush_rules();
     $this->tag_id = $this->factory->tag->create(array('slug' => 'tag-slug'));
     $this->cat_id = $this->factory->category->create(array('slug' => 'cat-slug'));
     $this->tax_id = $this->factory->term->create(array('taxonomy' => 'testtax', 'slug' => 'tax-slug'));
     $this->tax_id2 = $this->factory->term->create(array('taxonomy' => 'testtax', 'slug' => 'tax-slug2'));
     $this->post_id = $this->factory->post->create();
     wp_set_object_terms($this->post_id, $this->cat_id, 'category');
     wp_set_object_terms($this->post_id, array($this->tax_id, $this->tax_id2), 'testtax');
     $this->cat = get_term($this->cat_id, 'category');
     _make_cat_compat($this->cat);
     $this->tag = get_term($this->tag_id, 'post_tag');
     $this->uncat = get_term_by('slug', 'uncategorized', 'category');
     _make_cat_compat($this->uncat);
     add_action('pre_get_posts', array($this, 'pre_get_posts_tax_category_tax_query'));
 }
Пример #12
0
 function setUp()
 {
     parent::setUp();
     $this->month_url = get_month_link(date('Y'), date('m'));
     $this->year_url = get_year_link(date('Y'));
     $this->post_ids = $this->factory->post->create_many(8, array('post_type' => 'post', 'post_author' => '1'));
 }
Пример #13
0
 function setUp()
 {
     parent::setUp();
     global $rcp_levels_db;
     $args = array('name' => 'Gold', 'description' => 'The Gold Plan', 'duration' => '1', 'duration_unit' => 'month', 'price' => '10', 'fee' => '0', 'list_order' => '0', 'level' => '5', 'status' => 'active', 'role' => 'subscriber');
     $this->_level_id = $rcp_levels_db->insert($args);
 }
 /**
  * Set up.
  */
 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();
     // WPCS: global override ok.
     $this->wp_customize = $GLOBALS['wp_customize'];
     $this->wp_customize->add_setting('foo', array('default' => 'foo_default'));
     $this->wp_customize->add_setting('bar', array('default' => 'bar_default'));
     $this->manager = new Customize_Snapshot_Manager($this->plugin);
     $this->manager->init();
     $this->user_id = $this->factory()->user->create(array('role' => 'administrator'));
     remove_action('after_setup_theme', 'twentyfifteen_setup');
     remove_action('after_setup_theme', 'twentysixteen_setup');
     remove_all_actions('send_headers');
     // Prevent X-hacker header in VIP Quickstart.
     // For why these hooks have to be removed, see <https://github.com/Automattic/nginx-http-concat/issues/5>.
     $this->css_concat_init_priority = has_action('init', 'css_concat_init');
     if ($this->css_concat_init_priority) {
         remove_action('init', 'css_concat_init', $this->css_concat_init_priority);
     }
     $this->js_concat_init_priority = has_action('init', 'js_concat_init');
     if ($this->js_concat_init_priority) {
         remove_action('init', 'js_concat_init', $this->js_concat_init_priority);
     }
 }
 function setUp()
 {
     parent::setUp();
     $this->noop = new NOOP_Translations();
     $this->entry = new Translation_Entry(array('singular' => 'baba'));
     $this->plural_entry = new Translation_Entry(array('singular' => 'dyado', 'plural' => 'dyados', 'translations' => array('dyadox', 'dyadoy')));
 }
Пример #16
0
 function setUp()
 {
     parent::setUp();
     $this->ticket_data = array('post_title' => 'Test Ticket', 'post_name' => 'Test Ticket', 'post_author' => 1, 'post_content' => 'In hac habitasse platea dictumst. Nulla neque dolor, sagittis eget, iaculis quis, molestie non, velit. Nullam cursus lacinia erat. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Donec vitae orci sed dolor rutrum auctor.');
     $this->reply_data = array('post_content' => 'Vivamus aliquet elit ac nisl. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. Nullam dictum felis eu pede mollis pretium. Nullam vel sem. Praesent nonummy mi in odio.');
     update_user_meta(1, 'wpas_can_be_assigned', 'yes');
 }
Пример #17
0
 /**
  * Parse the file to get the exported data before the first test.
  */
 public function setUp()
 {
     parent::setUp();
     if (!$this->export_data) {
         $this->parse_file();
     }
 }
Пример #18
0
 public function setUp()
 {
     parent::setUp();
     $_SERVER['HTTP_REFERER'] = '';
     $_SERVER['REQUEST_URI'] = '';
     $_REQUEST['_wp_http_referer'] = '';
 }
Пример #19
0
 function setUp()
 {
     parent::setUp();
     add_filter('extra_theme_headers', array($this, '_theme_data_extra_headers'));
     wp_clean_themes_cache();
     unset($GLOBALS['wp_themes']);
 }
Пример #20
0
	function setUp() {
		parent::setUp();
		$this->old_wp_scripts = isset( $GLOBALS['wp_scripts'] ) ? $GLOBALS['wp_scripts'] : null;
		remove_action( 'wp_default_scripts', 'wp_default_scripts' );
		$GLOBALS['wp_scripts'] = new WP_Scripts();
		$GLOBALS['wp_scripts']->default_version = get_bloginfo( 'version' );
	}
Пример #21
0
	function setUp() {
		global $wpdb;
		parent::setUp();
		$this->suppress = $wpdb->suppress_errors();

		$_SERVER['REMOTE_ADDR'] = '';
	}
 /**
  * setUp
  */
 public function setUp()
 {
     parent::setUp();
     $this->Field = new MW_WP_Form_Field_Checkbox();
     $this->form_key = MWF_Config::NAME . '-1';
     $this->Data = MW_WP_Form_Data::getInstance($this->form_key);
 }
	function setUp() {
		parent::setUp();
		// keep track of users we create
		$this->_flush_roles();

		$this->orig_users = get_users();
	}
 function setUp()
 {
     parent::setUp();
     self::$instance = new Publishing_Checklist();
     $args = array('label' => esc_html__('Word Count', 'publishing-checklist'), 'callback' => 'ensure_minimum_200_words', 'explanation' => esc_html__('Posts should be at least 200 words.', 'publishing-checklist'), 'post_type' => array('post'));
     Publishing_Checklist()->register_task('test-publishing-checklist-word-count', $args);
 }
Пример #25
0
 function setUp()
 {
     parent::setUp();
     $this->post = $this->factory->post->create_and_get();
     $file = DIR_TESTDATA . '/images/canola.jpg';
     $this->attachment_id = $this->factory->attachment->create_object($file, $this->post->ID, array('post_mime_type' => 'image/jpeg'));
 }
 /**
  * Set up the test.
  */
 function setUp()
 {
     parent::setUp();
     wl_configure_wordpress_test();
     wl_empty_blog();
     rl_empty_dataset();
 }
Пример #27
0
	public function setUp() {
		parent::setUp();

		$user = wp_insert_user( array(
			'user_login' => 'test',
			'user_pass'       => 'pass',
			'first_name' => 'Tester',
			'user_email' => '*****@*****.**'
		) );

		$this->member = new RCP_Member( $user );

		$levels = new RCP_Levels;

		$this->level_id = $levels->insert( array(
			'name'          => 'Gold',
			'duration'      => 1,
			'duration_unit' => 'month',
			'level'         => 1,
			'status'        => 'active'
		) );

		$this->level_id_2 = $levels->insert( array(
			'name'          => 'Silver',
			'duration'      => 1,
			'duration_unit' => 'month',
			'status'        => 'active',
			'level'         => 3
		) );
	}
Пример #28
0
 function setUp()
 {
     parent::setUp();
     $this->author = new WP_User($this->factory->user->create(array('role' => 'author')));
     $this->meta_id = add_metadata('user', $this->author->ID, 'meta_key', 'meta_value');
     $this->delete_meta_id = add_metadata('user', $this->author->ID, 'delete_meta_key', 'delete_meta_value');
 }
 public function setUp()
 {
     parent::setUp();
     add_theme_support('infinite-scroll');
     remove_action('init', 'the_neverending_home_page_init', 20);
     $this->infinite_scroll = new The_Neverending_Home_Page();
 }
Пример #30
0
 public function setUp()
 {
     parent::setUp();
     // Preserving global variables
     global $content_width;
     $this->_globals['content_width'] = $content_width;
 }