Skip to content

Commit 7a5e90c

Browse files
committed
Add utf8mb4_unicode_520_ci to the emulated collations
WordPress uses utf8mb4_unicode_520_ci by default, but it was missing from INFORMATION_SCHEMA.COLLATIONS and SHOW COLLATION.
1 parent af51a95 commit 7a5e90c

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

‎packages/mysql-on-sqlite/src/sqlite/class-wp-sqlite-information-schema-builder.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ public function get_computed_information_schema_table_definition( string $table_
450450
('utf8_unicode_ci', 'utf8', 192, '', 'Yes', 8, 'PAD SPACE'),
451451
('utf8mb4_bin', 'utf8mb4', 46, '', 'Yes', 1, 'PAD SPACE'),
452452
('utf8mb4_unicode_ci', 'utf8mb4', 224, '', 'Yes', 8, 'PAD SPACE'),
453+
('utf8mb4_unicode_520_ci', 'utf8mb4', 246, '', 'Yes', 8, 'PAD SPACE'),
453454
('utf8mb4_0900_ai_ci', 'utf8mb4', 255, 'Yes', 'Yes', 0, 'NO PAD')
454455
)";
455456
default:

‎packages/mysql-on-sqlite/tests/WP_MySQL_On_SQLite_Metadata_Tests.php‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,15 @@ public function testInfromationSchemaCollations(): void {
186186
'SORTLEN' => '1',
187187
'PAD_ATTRIBUTE' => 'PAD SPACE',
188188
),
189+
(object) array(
190+
'COLLATION_NAME' => 'utf8mb4_unicode_520_ci',
191+
'CHARACTER_SET_NAME' => 'utf8mb4',
192+
'ID' => '246',
193+
'IS_DEFAULT' => '',
194+
'IS_COMPILED' => 'Yes',
195+
'SORTLEN' => '8',
196+
'PAD_ATTRIBUTE' => 'PAD SPACE',
197+
),
189198
(object) array(
190199
'COLLATION_NAME' => 'utf8mb4_unicode_ci',
191200
'CHARACTER_SET_NAME' => 'utf8mb4',
@@ -516,19 +525,20 @@ public function testShowCollation(): void {
516525
// Simple.
517526
$this->assertQuery( 'SHOW COLLATION' );
518527
$actual = $this->last_result;
519-
$this->assertCount( 7, $actual );
528+
$this->assertCount( 8, $actual );
520529
$this->assertEquals( 'binary', $actual[0]->Collation );
521530
$this->assertEquals( 'utf8_bin', $actual[1]->Collation );
522531
$this->assertEquals( 'utf8_general_ci', $actual[2]->Collation );
523532
$this->assertEquals( 'utf8_unicode_ci', $actual[3]->Collation );
524533
$this->assertEquals( 'utf8mb4_bin', $actual[4]->Collation );
525534
$this->assertEquals( 'utf8mb4_unicode_ci', $actual[5]->Collation );
526-
$this->assertEquals( 'utf8mb4_0900_ai_ci', $actual[6]->Collation );
535+
$this->assertEquals( 'utf8mb4_unicode_520_ci', $actual[6]->Collation );
536+
$this->assertEquals( 'utf8mb4_0900_ai_ci', $actual[7]->Collation );
527537

528538
// With LIKE clause.
529539
$this->assertQuery( "SHOW COLLATION LIKE 'utf8%'" );
530540
$actual = $this->last_result;
531-
$this->assertCount( 6, $actual );
541+
$this->assertCount( 7, $actual );
532542
$this->assertEquals( 'utf8_bin', $actual[0]->Collation );
533543
$this->assertEquals( 'utf8_general_ci', $actual[1]->Collation );
534544
$this->assertEquals( 'utf8_unicode_ci', $actual[2]->Collation );

‎packages/mysql-on-sqlite/tests/WP_MySQL_On_SQLite_Tests.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4083,7 +4083,7 @@ public function testFoundRowsWithoutSqlCalcFoundRows(): void {
40834083
// SHOW COLLATION
40844084
$this->assertQuery( 'SHOW COLLATION' );
40854085
$result = $this->assertQuery( 'SELECT FOUND_ROWS()' );
4086-
$this->assertSame( '7', $result[0]->{'FOUND_ROWS()'} );
4086+
$this->assertSame( '8', $result[0]->{'FOUND_ROWS()'} );
40874087

40884088
// SHOW DATABASES
40894089
$this->assertQuery( 'SHOW DATABASES' );

0 commit comments

Comments
 (0)