function SchemaTest::checkSchemaComment

Same name in this branch
  1. 10 core/modules/sqlite/tests/src/Kernel/sqlite/SchemaTest.php \Drupal\Tests\sqlite\Kernel\sqlite\SchemaTest::checkSchemaComment()
  2. 10 core/modules/pgsql/tests/src/Kernel/pgsql/SchemaTest.php \Drupal\Tests\pgsql\Kernel\pgsql\SchemaTest::checkSchemaComment()
Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php \Drupal\KernelTests\Core\Database\SchemaTest::checkSchemaComment()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php \Drupal\KernelTests\Core\Database\SchemaTest::checkSchemaComment()
  3. 11.x core/modules/sqlite/tests/src/Kernel/sqlite/SchemaTest.php \Drupal\Tests\sqlite\Kernel\sqlite\SchemaTest::checkSchemaComment()
  4. 11.x core/modules/mysql/tests/src/Kernel/mysql/SchemaTest.php \Drupal\Tests\mysql\Kernel\mysql\SchemaTest::checkSchemaComment()
  5. 11.x core/modules/pgsql/tests/src/Kernel/pgsql/SchemaTest.php \Drupal\Tests\pgsql\Kernel\pgsql\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.