Skip to content

Commit 61d19ef

Browse files
committed
fix tests for new default mysql collation
1 parent de03db8 commit 61d19ef

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/Phinx/Db/Adapter/MysqlAdapterTest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,9 @@ public function testCreateTableAndInheritDefaultCollation()
409409
->save();
410410
$this->assertTrue($adapter->hasTable('table_with_default_collation'));
411411
$row = $adapter->fetchRow(sprintf("SHOW TABLE STATUS WHERE Name = '%s'", 'table_with_default_collation'));
412-
$this->assertEquals('utf8_unicode_ci', $row['Collation']);
412+
// This catches legacy collations as well as the new utf8mb3_general_ci default from MySQL 8.0.30+
413+
$this->assertStringStartsWith('utf8', $row['Collation']);
414+
$this->assertStringEndsWith('_general_ci', $row['Collation']);
413415
}
414416

415417
public function testCreateTableWithLatin1Collate()
@@ -772,7 +774,9 @@ public function testAddStringColumnWithCustomCollation()
772774
$table->addColumn('string_collation_default', 'string', [])->save();
773775
$table->addColumn('string_collation_custom', 'string', ['collation' => 'utf8mb4_unicode_ci'])->save();
774776
$rows = $this->adapter->fetchAll('SHOW FULL COLUMNS FROM table_custom_collation');
775-
$this->assertEquals('utf8_general_ci', $rows[1]['Collation']);
777+
// This catches legacy collations as well as the new utf8mb3_general_ci default from MySQL 8.0.30+
778+
$this->assertStringStartsWith('utf8', $rows[1]['Collation']);
779+
$this->assertStringEndsWith('_general_ci', $rows[1]['Collation']);
776780
$this->assertEquals('utf8mb4_unicode_ci', $rows[2]['Collation']);
777781
}
778782

0 commit comments

Comments
 (0)