Skip to content

Commit

Permalink
fix tests for new default mysql collation
Browse files Browse the repository at this point in the history
  • Loading branch information
LordSimal committed Oct 2, 2022
1 parent de03db8 commit b80fa00
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/Phinx/Db/Adapter/MysqlAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,9 @@ public function testCreateTableAndInheritDefaultCollation()
->save();
$this->assertTrue($adapter->hasTable('table_with_default_collation'));
$row = $adapter->fetchRow(sprintf("SHOW TABLE STATUS WHERE Name = '%s'", 'table_with_default_collation'));
$this->assertEquals('utf8_unicode_ci', $row['Collation']);
// This catches legacy collations as well as the new utf8mb3_unicode_ci default from MySQL 8.0.30+
$this->assertStringStartsWith('utf8', $row['Collation']);
$this->assertStringEndsWith('_unicode_ci', $row['Collation']);
}

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

Expand Down

0 comments on commit b80fa00

Please sign in to comment.