function CommentUpdateTest::testPublishedEntityKey
Tests that the comment entity type has a 'published' entity key.
See also
File
- 
              core/modules/ comment/ tests/ src/ Functional/ Update/ CommentUpdateTest.php, line 59 
Class
- CommentUpdateTest
- Tests that comment settings are properly updated during database updates.
Namespace
Drupal\Tests\comment\Functional\UpdateCode
public function testPublishedEntityKey() {
  // Check that the 'published' entity key does not exist prior to the update.
  $entity_type = \Drupal::entityDefinitionUpdateManager()->getEntityType('comment');
  $this->assertFalse($entity_type->getKey('published'));
  // Run updates.
  $this->runUpdates();
  // Check that the entity key exists and it has the correct value.
  $entity_type = \Drupal::entityDefinitionUpdateManager()->getEntityType('comment');
  $this->assertEqual('status', $entity_type->getKey('published'));
  // Check that the {comment_field_data} table status index has been created.
  $this->assertTrue(\Drupal::database()->schema()
    ->indexExists('comment_field_data', 'comment__status_comment_type'));
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
