WPDB: Some character set tests were failing if DB_CHARSET was empty, or a non-utf8 character set.

git-svn-id: https://develop.svn.wordpress.org/trunk@31372 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast
2015-02-09 00:38:11 +00:00
parent afdd7da11b
commit be3c59e64c
2 changed files with 36 additions and 5 deletions

View File

@@ -729,12 +729,23 @@ class Tests_DB extends WP_UnitTestCase {
*/
function test_process_fields() {
global $wpdb;
if ( $wpdb->charset ) {
$expected_charset = $wpdb->charset;
} else {
$expected_charset = $wpdb->get_col_charset( $wpdb->posts, 'post_content' );
}
if ( ! in_array( $expected_charset, array( 'utf8', 'utf8mb4', 'latin1' ) ) ) {
$this->markTestSkipped( "This test only works with utf8, utf8mb4 or latin1 character sets" );
}
$data = array( 'post_content' => '¡foo foo foo!' );
$expected = array(
'post_content' => array(
'value' => '¡foo foo foo!',
'format' => '%s',
'charset' => $wpdb->charset,
'charset' => $expected_charset,
'ascii' => false,
)
);