|
@@ 591-608 (lines=18) @@
|
| 588 |
|
* @dataProvider data_test_get_table_charset |
| 589 |
|
* @ticket 21212 |
| 590 |
|
*/ |
| 591 |
|
function test_get_table_charset( $drop, $create, $table, $expected_charset ) |
| 592 |
|
{ |
| 593 |
|
self::$_wpdb->query($drop); |
| 594 |
|
|
| 595 |
|
if (! self::$_wpdb->has_cap('utf8mb4') && preg_match('/utf8mb[34]/i', $create) ) { |
| 596 |
|
$this->markTestSkipped("This version of MySQL doesn't support utf8mb4."); |
| 597 |
|
return; |
| 598 |
|
} |
| 599 |
|
|
| 600 |
|
self::$_wpdb->query($create); |
| 601 |
|
|
| 602 |
|
$charset = self::$_wpdb->get_table_charset($table); |
| 603 |
|
$this->assertEquals($charset, $expected_charset); |
| 604 |
|
|
| 605 |
|
$charset = self::$_wpdb->get_table_charset(strtoupper($table)); |
| 606 |
|
$this->assertEquals($charset, $expected_charset); |
| 607 |
|
|
| 608 |
|
self::$_wpdb->query($drop); |
| 609 |
|
} |
| 610 |
|
|
| 611 |
|
/** |
|
@@ 633-649 (lines=17) @@
|
| 630 |
|
* @dataProvider data_test_get_column_charset |
| 631 |
|
* @ticket 21212 |
| 632 |
|
*/ |
| 633 |
|
function test_get_column_charset( $drop, $create, $table, $expected_charset ) |
| 634 |
|
{ |
| 635 |
|
self::$_wpdb->query($drop); |
| 636 |
|
|
| 637 |
|
if (! self::$_wpdb->has_cap('utf8mb4') && preg_match('/utf8mb[34]/i', $create) ) { |
| 638 |
|
$this->markTestSkipped("This version of MySQL doesn't support utf8mb4."); |
| 639 |
|
return; |
| 640 |
|
} |
| 641 |
|
|
| 642 |
|
self::$_wpdb->query($create); |
| 643 |
|
|
| 644 |
|
foreach ( $expected_charset as $column => $charset ) { |
| 645 |
|
$this->assertEquals($charset, self::$_wpdb->get_col_charset($table, $column)); |
| 646 |
|
$this->assertEquals($charset, self::$_wpdb->get_col_charset(strtoupper($table), strtoupper($column))); |
| 647 |
|
} |
| 648 |
|
|
| 649 |
|
self::$_wpdb->query($drop); |
| 650 |
|
} |
| 651 |
|
|
| 652 |
|
/** |