Changeset 43629 for trunk/tests/phpunit/tests/admin/includesSchema.php
- Timestamp:
- 09/05/2018 11:01:36 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/admin/includesSchema.php
r43628 r43629 8 8 9 9 private static $options; 10 private static $blogmeta; 10 11 private static $sitemeta; 11 12 … … 17 18 18 19 self::$options = 'testprefix_options'; 20 self::$blogmeta = 'testprefix_blogmeta'; 19 21 self::$sitemeta = 'testprefix_sitemeta'; 20 22 21 23 $options = self::$options; 24 $blogmeta = self::$blogmeta; 22 25 $sitemeta = self::$sitemeta; 23 26 … … 36 39 PRIMARY KEY (option_id), 37 40 UNIQUE KEY option_name (option_name) 41 ) {$charset_collate} 42 " 43 ); 44 $wpdb->query( 45 " 46 CREATE TABLE {$blogmeta} ( 47 meta_id bigint(20) unsigned NOT NULL auto_increment, 48 blog_id bigint(20) unsigned NOT NULL default '0', 49 meta_key varchar(255) default NULL, 50 meta_value longtext, 51 PRIMARY KEY (meta_id), 52 KEY meta_key (meta_key({$max_index_length})), 53 KEY blog_id (blog_id) 38 54 ) {$charset_collate} 39 55 " … … 61 77 62 78 $options = self::$options; 79 $blogmeta = self::$blogmeta; 63 80 $sitemeta = self::$sitemeta; 64 81 65 82 $wpdb->query( "DROP TABLE IF EXISTS {$options}" ); 83 $wpdb->query( "DROP TABLE IF EXISTS {$blogmeta}" ); 66 84 $wpdb->query( "DROP TABLE IF EXISTS {$sitemeta}" ); 67 85 } … … 158 176 159 177 /** 178 * @ticket 44896 179 * @group multisite 180 * @group ms-required 181 * @dataProvider data_populate_site_meta 182 */ 183 function test_populate_site_meta( $meta, $expected ) { 184 global $wpdb; 185 186 $orig_blogmeta = $wpdb->blogmeta; 187 $wpdb->blogmeta = self::$blogmeta; 188 189 populate_site_meta( 42, $meta ); 190 191 $results = array(); 192 foreach ( $expected as $meta_key => $value ) { 193 $results[ $meta_key ] = get_site_meta( 42, $meta_key, true ); 194 } 195 196 $wpdb->query( "TRUNCATE TABLE {$wpdb->blogmeta}" ); 197 198 $wpdb->blogmeta = $orig_blogmeta; 199 200 $this->assertEquals( $expected, $results ); 201 } 202 203 public function data_populate_site_meta() { 204 return array( 205 array( 206 array(), 207 array( 208 'unknown_value' => '', 209 ), 210 ), 211 array( 212 array( 213 'custom_meta' => '1', 214 ), 215 array( 216 'custom_meta' => '1', 217 ), 218 ), 219 ); 220 } 221 222 /** 160 223 * @ticket 44895 224 * @group multisite 161 225 * @dataProvider data_populate_network_meta 162 226 */
Note: See TracChangeset
for help on using the changeset viewer.