Наследование: extends PHPUnit_Framework_TestCase
Пример #1
0
 public function setUp()
 {
     global $post;
     parent::setUp();
     $post = $this->factory->post->create_and_get();
     $this->post = new WordPress_GitHub_Sync_Post($post->ID);
 }
Пример #2
0
 function tearDown()
 {
     global $wp_rewrite;
     $wp_rewrite->init();
     update_option('home', $this->home_url);
     parent::tearDown();
 }
Пример #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();
 }
Пример #6
0
 function tearDown()
 {
     foreach (array('curl', 'streams', 'fsockopen') as $t) {
         remove_filter("use_{$t}_transport", '__return_false');
     }
     parent::tearDown();
 }
Пример #7
0
 function tearDown()
 {
     remove_filter('extra_theme_headers', array($this, '_theme_data_extra_headers'));
     wp_clean_themes_cache();
     unset($GLOBALS['wp_themes']);
     parent::tearDown();
 }
Пример #8
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);
 }
Пример #9
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'));
 }
Пример #10
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');
 }
Пример #11
0
 function tearDown()
 {
     global $wpdb;
     update_site_option('ms_files_rewriting', 0);
     $wpdb->suppress_errors($this->suppress);
     parent::tearDown();
 }
Пример #12
0
 public function tearDown()
 {
     // Restoring global variables
     global $content_width;
     $content_width = $this->_globals['content_width'];
     parent::tearDown();
 }
Пример #13
0
 /**
  * Finish the test suite for the CASServerPlugin class.
  */
 function tearDown()
 {
     parent::tearDown();
     unset($this->server);
     unset($this->redirect_location);
     remove_filter('wp_redirect', array($this, 'wp_redirect_handler'));
 }
 function setUp()
 {
     parent::setUp();
     set_current_screen('edit-page');
     $GLOBALS['hook_suffix'] = '';
     $this->table = _get_list_table('WP_Posts_List_Table');
 }
 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 assertPreConditions()
 {
     parent::assertPreConditions();
     // Reinit some of the globals that might have been cleared by BP_UnitTestCase::clean_up_global_scope().
     // This is here because it didn't work in clean_up_global_scope(); I don't know why.
     do_action('bp_setup_globals');
 }
Пример #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
 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');
 }
 /**
  * Break down for next test
  */
 function tearDown()
 {
     global $wp_rewrite;
     $wp_rewrite->set_permalink_structure('');
     _destroy_uploads();
     parent::tearDown();
 }
Пример #20
0
 public function tearDown()
 {
     parent::tearDown();
     $_SERVER['HTTP_REFERER'] = '';
     $_SERVER['REQUEST_URI'] = '';
     $_REQUEST['_wp_http_referer'] = '';
 }
Пример #21
0
 function setUp()
 {
     set_time_limit(0);
     if (!self::$ignore_files) {
         self::$ignore_files = $this->scan_user_uploads();
     }
     if (!self::$hooks_saved) {
         $this->_backup_hooks();
     }
     global $wpdb;
     $wpdb->suppress_errors = false;
     $wpdb->show_errors = true;
     $wpdb->db_connect();
     ini_set('display_errors', 1);
     $this->factory = new WP_UnitTest_Factory();
     $this->clean_up_global_scope();
     /*
      * When running core tests, ensure that post types and taxonomies
      * are reset for each test. We skip this step for non-core tests,
      * given the large number of plugins that register post types and
      * taxonomies at 'init'.
      */
     if (defined('WP_RUN_CORE_TESTS') && WP_RUN_CORE_TESTS) {
         $this->reset_post_types();
         $this->reset_taxonomies();
         $this->reset_post_statuses();
     }
     $this->start_transaction();
     $this->expectDeprecated();
     add_filter('wp_die_handler', array($this, 'get_wp_die_handler'));
 }
 /**
  * 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
 /**
  * Overload WP_UnitTestcase to ignore deprecated notices
  * thrown by use of wp_title() in Timber
  */
 public function expectedDeprecated()
 {
     if (false !== ($key = array_search('wp_title', $this->caught_deprecated))) {
         unset($this->caught_deprecated[$key]);
     }
     parent::expectedDeprecated();
 }