You are here

protected function LangcodeToAsciiUpdateTest::getColumnCollation in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Entity/Update/LangcodeToAsciiUpdateTest.php \Drupal\system\Tests\Entity\Update\LangcodeToAsciiUpdateTest::getColumnCollation()

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/src/Tests/Entity/Update/LangcodeToAsciiUpdateTest.php
Tests that the column collation has been updated on MySQL.

File

core/modules/system/src/Tests/Entity/Update/LangcodeToAsciiUpdateTest.php, line 69
Contains \Drupal\system\Tests\Entity\Update\LangcodeToAsciiUpdateTest.

Class

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

Namespace

Drupal\system\Tests\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);
}