public function CommentUpdateTest::testCommentEntityTypeAndFieldNameRequired in Drupal 8
Tests whether the 'entity_type' and 'field_name' columns are required.
See also
File
- core/
modules/ comment/ tests/ src/ Functional/ Update/ CommentUpdateTest.php, line 98
Class
- CommentUpdateTest
- Tests that comment settings are properly updated during database updates.
Namespace
Drupal\Tests\comment\Functional\UpdateCode
public function testCommentEntityTypeAndFieldNameRequired() {
$database = \Drupal::database();
$this
->assertEquals(2, $database
->query('SELECT count(*) FROM {comment_field_data}')
->fetchField());
if ($database
->driver() === 'mysql') {
$table_description = $database
->query('DESCRIBE {comment_field_data}')
->fetchAllAssoc('Field');
$this
->assertEquals('YES', $table_description['entity_type']->Null);
$this
->assertEquals('YES', $table_description['field_name']->Null);
}
$this
->runUpdates();
$this
->assertEquals(2, $database
->query('SELECT count(*) FROM {comment_field_data}')
->fetchField());
if ($database
->driver() === 'mysql') {
$table_description = $database
->query('DESCRIBE {comment_field_data}')
->fetchAllAssoc('Field');
$this
->assertEquals('NO', $table_description['entity_type']->Null);
$this
->assertEquals('NO', $table_description['field_name']->Null);
}
}