diff --git a/tests/phpunit/tests/dbdelta.php b/tests/phpunit/tests/dbdelta.php
index ecf7c8a294..9bdf89472b 100644
a
|
b
|
class Tests_dbDelta extends WP_UnitTestCase { |
361 | 361 | $this->markTestSkipped( 'This test requires utf8mb4 support in MySQL.' ); |
362 | 362 | } |
363 | 363 | |
364 | | $table_name = 'test_truncated_index'; |
| 364 | // This table needs to be actually created |
| 365 | remove_filter( 'query', array( $this, '_create_temporary_tables' ) ); |
| 366 | remove_filter( 'query', array( $this, '_drop_temporary_tables' ) ); |
| 367 | |
| 368 | $table_name = "{$wpdb->prefix}test_truncated_index"; |
365 | 369 | |
366 | | $create = "CREATE TABLE $table_name (\n a varchar(255) COLLATE utf8mb4_unicode_ci,\n KEY a (a)\n)"; |
| 370 | $create = " |
| 371 | CREATE TABLE $table_name ( |
| 372 | a varchar(255) COLLATE utf8mb4_unicode_ci, |
| 373 | KEY a_key (a) |
| 374 | ) ENGINE=InnoDB ROW_FORMAT=COMPACT"; |
| 375 | |
| 376 | $suppress_errors = $wpdb->suppress_errors(); |
367 | 377 | $wpdb->query( $create ); |
| 378 | $wpdb->suppress_errors( $suppress_errors ); |
| 379 | $tables = $wpdb->get_results( "SHOW TABLES LIKE '{$table_name}'" ); |
| 380 | if ( empty( $tables ) ) { |
| 381 | $this->markTestSkipped( 'This test expects table to be created, but index silently truncated.' ); |
| 382 | } |
368 | 383 | |
369 | 384 | $actual = dbDelta( $create, false ); |
370 | 385 | |
| 386 | $wpdb->query( "DROP TABLE IF EXISTS $table_name;" ); |
| 387 | |
371 | 388 | $this->assertSame( array(), $actual ); |
372 | 389 | } |
373 | 390 | |