• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress develop tests

WordPress develop tests

WordPress develop tests a2z

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / Tests_Admin_Includes_Schema::wpSetUpBeforeClass() – Make sure the schema code is loaded before the tests are run.

You appear to be a bot. Output may be restricted

Description

Make sure the schema code is loaded before the tests are run.

Usage

Tests_Admin_Includes_Schema::wpSetUpBeforeClass();

Parameters

Returns

void

Source

File name: wordpress-develop-tests/phpunit/tests/admin/includesSchema.php


Lines:

1 to 58 of 58
  public static function wpSetUpBeforeClass() {
    global $wpdb;

    self::$options  = 'testprefix_options';
    self::$blogmeta = 'testprefix_blogmeta';
    self::$sitemeta = 'testprefix_sitemeta';

    $options  = self::$options;
    $blogmeta = self::$blogmeta;
    $sitemeta = self::$sitemeta;

    require_once( ABSPATH . 'wp-admin/includes/schema.php' );

    $charset_collate  = $wpdb->get_charset_collate();
    $max_index_length = 191;

    // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared
    $wpdb->query(
      "
			CREATE TABLE {$options} (
				option_id bigint(20) unsigned NOT NULL auto_increment,
				option_name varchar(191) NOT NULL default '',
				option_value longtext NOT NULL,
				autoload varchar(20) NOT NULL default 'yes',
				PRIMARY KEY  (option_id),
				UNIQUE KEY option_name (option_name)
			) {$charset_collate}
			"
    );
    $wpdb->query(
      "
			CREATE TABLE {$blogmeta} (
				meta_id bigint(20) unsigned NOT NULL auto_increment,
				blog_id bigint(20) unsigned NOT NULL default '0',
				meta_key varchar(255) default NULL,
				meta_value longtext,
				PRIMARY KEY  (meta_id),
				KEY meta_key (meta_key({$max_index_length})),
				KEY blog_id (blog_id)
			) {$charset_collate}
			"
    );
    $wpdb->query(
      "
			CREATE TABLE {$sitemeta} (
				meta_id bigint(20) unsigned NOT NULL auto_increment,
				site_id bigint(20) unsigned NOT NULL default '0',
				meta_key varchar(255) default NULL,
				meta_value longtext,
				PRIMARY KEY  (meta_id),
				KEY meta_key (meta_key({$max_index_length})),
				KEY site_id (site_id)
			) {$charset_collate}
			"
    );
    // phpcs:enable
  }
 

 View on GitHub

Published: 26th November 2019 | Last updated: 27th November 2019

Primary Sidebar

Information

Function name: Tests_Admin_Includes_Schema::wpSetUpBeforeClass
Class ref: Tests_Admin_Includes_Schema
Plugin ref: WordPress develop tests
Version: 5.3
Sourcefile: phpunit/tests/admin/includesSchema.php
File ref: phpunit/tests/admin/includesSchema.php
Deprecated?: No
API Letters: A,I,S,T,W

Footer

WordPress develop tests
WordPress develop tests
WordPress develop tests a2z
WordPress 5.6
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  develop.wp-a2z.org
© Copyright WordPress develop tests 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites