WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/09/2015 12:38:11 AM (5 years ago)
Author:
pento
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/db.php

    r30704 r31372  
    730730    function test_process_fields() {
    731731        global $wpdb;
     732
     733        if ( $wpdb->charset ) {
     734            $expected_charset = $wpdb->charset;
     735        } else {
     736            $expected_charset = $wpdb->get_col_charset( $wpdb->posts, 'post_content' );
     737        }
     738
     739        if ( ! in_array( $expected_charset, array( 'utf8', 'utf8mb4', 'latin1' ) ) ) {
     740            $this->markTestSkipped( "This test only works with utf8, utf8mb4 or latin1 character sets" );
     741        }
     742
    732743        $data = array( 'post_content' => '¡foo foo foo!' );
    733744        $expected = array(
     
    735746                'value' => '¡foo foo foo!',
    736747                'format' => '%s',
    737                 'charset' => $wpdb->charset,
     748                'charset' => $expected_charset,
    738749                'ascii' => false,
    739750            )
Note: See TracChangeset for help on using the changeset viewer.