Make WordPress Core


Ignore:
Timestamp:
09/28/2015 01:16:29 AM (10 years ago)
Author:
pento
Message:

WPDB: Make sure we don't run sanity checks on DB dropins.

Previously, we'd run the sanity checks if is_mysql was not set to false. This caused problems for DB drop-ins that didn't define is_mysql at all. Instead, we can just check if is_mysql is empty().

Also fix some unit tests that accidently ran correctly because of the strict false === comparison.

Fixes #33501.

File:
1 edited

Legend:

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

    r33425 r34655  
    639639
    640640    /**
     641     * @dataProvider data_test_get_column_charset
     642     * @ticket 33501
     643     */
     644    function test_get_column_charset_is_mysql_undefined( $drop, $create, $table, $columns ) {
     645        self::$_wpdb->query( $drop );
     646
     647        if ( ! self::$_wpdb->has_cap( 'utf8mb4' ) && preg_match( '/utf8mb[34]/i', $create ) ) {
     648            $this->markTestSkipped( "This version of MySQL doesn't support utf8mb4." );
     649            return;
     650        }
     651
     652        unset( self::$_wpdb->is_mysql );
     653
     654        self::$_wpdb->query( $create );
     655
     656        $columns = array_keys( $columns );
     657        foreach ( $columns as $column => $charset ) {
     658            $this->assertEquals( false, self::$_wpdb->get_col_charset( $table, $column ) );
     659        }
     660
     661        self::$_wpdb->query( $drop );
     662
     663        self::$_wpdb->is_mysql = true;
     664    }
     665
     666    /**
    641667     * @ticket 21212
    642668     */
Note: See TracChangeset for help on using the changeset viewer.