function SchemaTest::checkSchemaComment

Checks that a table or column comment matches a given description.

Parameters

string $description: The asserted description.

string $table: The table to test.

string|null $column: Optional column to test.

Overrides DriverSpecificSchemaTestBase::checkSchemaComment

File

core/modules/mysql/tests/src/Kernel/mysql/SchemaTest.php, line 26

Class

SchemaTest
Tests schema API for the MySQL driver.

Namespace

Drupal\Tests\mysql\Kernel\mysql

Code

public function checkSchemaComment(string $description, string $table, ?string $column = NULL) : void {
  $comment = $this->schema
    ->getComment($table, $column);
  $max_length = $column ? 255 : 60;
  $description = Unicode::truncate($description, $max_length, TRUE, TRUE);
  $this->assertSame($description, $comment, 'The comment matches the schema description.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.