当前位置: 首页>>代码示例>>PHP>>正文


PHP WP_UnitTestCase::setUp方法代码示例

本文整理汇总了PHP中WP_UnitTestCase::setUp方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_UnitTestCase::setUp方法的具体用法?PHP WP_UnitTestCase::setUp怎么用?PHP WP_UnitTestCase::setUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WP_UnitTestCase的用法示例。


在下文中一共展示了WP_UnitTestCase::setUp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 function setUp()
 {
     parent::setUp();
     $this->container = new Container();
     $this->container->object('pluginMeta', array())->packager('cliPackager', 'Arrow\\Twig\\CliPackager');
     $this->packager = $this->container->lookup('cliPackager');
 }
开发者ID:dsawardekar,项目名称:arrow,代码行数:7,代码来源:CliPackagerTest.php

示例2: setUp

 function setUp()
 {
     parent::setUp();
     create_initial_taxonomies();
     $this->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
     $this->home_url = get_option('home');
 }
开发者ID:boonebgorges,项目名称:develop.wordpress,代码行数:7,代码来源:rewrite.php

示例3: setUp

 public function setUp()
 {
     if (!extension_loaded('openssl')) {
         $this->markTestSkipped('Tests_HTTP_Functions requires openssl.');
     }
     parent::setUp();
 }
开发者ID:rclilly,项目名称:wordpress-develop,代码行数:7,代码来源:functions.php

示例4: 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);
 }
开发者ID:boonebgorges,项目名称:develop.wordpress,代码行数:7,代码来源:numericSlugs.php

示例5: setUp

 function setUp()
 {
     parent::setUp();
     global $wp_rewrite;
     $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
     $wp_rewrite->flush_rules();
 }
开发者ID:boonebgorges,项目名称:wp,代码行数:7,代码来源:gallery.php

示例6: setUp

 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'));
 }
开发者ID:audiotheme,项目名称:audiotheme-agent,代码行数:7,代码来源:ClientRequestTest.php

示例7: setUp

 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();
 }
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:29,代码来源:EE_UnitTestCase.class.php

示例8: setUp

 function setUp()
 {
     parent::setUp();
     $this->post_type = rand_str(12);
     register_post_type($this->post_type);
     $this->q = new WP_Query();
 }
开发者ID:joemcgill,项目名称:develop.wordpress,代码行数:7,代码来源:search.php

示例9: setUp

 function setUp()
 {
     parent::setUp();
     if (!file_exists(WP_CONTENT_DIR . '/backups')) {
         mkdir(WP_CONTENT_DIR . '/backups', 0777);
     }
 }
开发者ID:signalfire,项目名称:signalfire-cloud-backup,代码行数:7,代码来源:test-database.php

示例10: setUp

 public function setUp()
 {
     global $wpdb;
     parent::setUp();
     $this->suppress = $wpdb->suppress_errors();
     update_site_option('upload_space_check_disabled', false);
 }
开发者ID:boonebgorges,项目名称:develop.wordpress,代码行数:7,代码来源:isUploadSpaceAvailable.php

示例11: setUp

 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'));
 }
开发者ID:boonebgorges,项目名称:wp,代码行数:26,代码来源:taxQuery.php

示例12: setUp

 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'));
 }
开发者ID:boonebgorges,项目名称:wp,代码行数:7,代码来源:getArchives.php

示例13: setUp

 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);
 }
开发者ID:ramiy,项目名称:restrict-content-pro,代码行数:7,代码来源:test-levels.php

示例14: setUp

 /**
  * 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);
     }
 }
开发者ID:xwp,项目名称:wp-customize-snapshots,代码行数:30,代码来源:test-class-customize-snapshot-manager.php

示例15: setUp

 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')));
 }
开发者ID:boonebgorges,项目名称:develop.wordpress,代码行数:7,代码来源:noopTranslations.php


注:本文中的WP_UnitTestCase::setUp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。