public function SchemaTest::checkSchemaComment in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php \Drupal\KernelTests\Core\Database\SchemaTest::checkSchemaComment()
- 9 core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php \Drupal\KernelTests\Core\Database\SchemaTest::checkSchemaComment()
Checks that a table or column comment matches a given description.
Parameters
$description: The asserted description.
$table: The table to test.
$column: Optional column to test.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Database/ SchemaTest.php, line 521
Class
- SchemaTest
- Tests table creation and modification via the schema API.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function checkSchemaComment($description, $table, $column = NULL) {
if (method_exists($this->schema, 'getComment')) {
$comment = $this->schema
->getComment($table, $column);
// The schema comment truncation for mysql is different.
if ($this->connection
->databaseType() === 'mysql') {
$max_length = $column ? 255 : 60;
$description = Unicode::truncate($description, $max_length, TRUE, TRUE);
}
$this
->assertEquals($description, $comment, 'The comment matches the schema description.');
}
}