WPDB: When a db.php drop-in is being used, and it doesn't explicitly define itself as connecting to MySQL, skip the character set checks. This ensures that existing drop-ins won't accidentally run checks that they don't support.

See #21212.


git-svn-id: https://develop.svn.wordpress.org/trunk@30375 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast
2014-11-18 03:37:23 +00:00
parent 92ae13f0ee
commit de33d35d1f
2 changed files with 37 additions and 7 deletions

View File

@@ -231,7 +231,7 @@ class Tests_DB_Charset extends WP_UnitTestCase {
protected $table_and_column_defs = array(
array(
'definition' => '( a INT, b FLOAT )',
'table_expected' => 'latin1',
'table_expected' => false,
'column_expected' => array( 'a' => false, 'b' => false )
),
array(
@@ -346,6 +346,32 @@ class Tests_DB_Charset extends WP_UnitTestCase {
self::$_wpdb->query( $drop );
}
/**
* @dataProvider data_test_get_column_charset
* @ticket 21212
*/
function test_get_column_charset_non_mysql( $drop, $create, $table, $columns ) {
self::$_wpdb->query( $drop );
if ( ! self::$_wpdb->has_cap( 'utf8mb4' ) && preg_match( '/utf8mb[34]/i', $create ) ) {
$this->markTestSkipped( "This version of MySQL doesn't support utf8mb4." );
return;
}
self::$_wpdb->is_mysql = false;
self::$_wpdb->query( $create );
$columns = array_keys( $columns );
foreach ( $columns as $column => $charset ) {
$this->assertEquals( false, self::$_wpdb->get_col_charset( $table, $column ) );
}
self::$_wpdb->query( $drop );
self::$_wpdb->is_mysql = true;
}
/**
* @ticket 21212
*/