You are here

protected function LangcodeToAsciiUpdateTest::getColumnCollation in Drupal 8

Determine the column collation.

Parameters

string $table: The table name.

string $column: The column name.

1 call to LangcodeToAsciiUpdateTest::getColumnCollation()
LangcodeToAsciiUpdateTest::testLangcodeColumnCollation in core/modules/system/tests/src/Functional/Entity/Update/LangcodeToAsciiUpdateTest.php
Tests that the column collation has been updated on MySQL.

File

core/modules/system/tests/src/Functional/Entity/Update/LangcodeToAsciiUpdateTest.php, line 66

Class

LangcodeToAsciiUpdateTest
Tests that the entity langcode fields have been updated to varchar_ascii.

Namespace

Drupal\Tests\system\Functional\Entity\Update

Code

protected function getColumnCollation($table, $column) {
  $query = Database::getConnection()
    ->query("SHOW FULL COLUMNS FROM {" . $table . "}");
  while ($row = $query
    ->fetchAssoc()) {
    if ($row['Field'] === $column) {
      return $row['Collation'];
    }
  }
  $this
    ->fail('No collation found for ' . $table . '.' . $column);
}