function CommentUpdateTest::testOwnerEntityKey

Tests that the comment entity type has an 'owner' entity key.

See also

comment_update_8700()

File

core/modules/comment/tests/src/Functional/Update/CommentUpdateTest.php, line 80

Class

CommentUpdateTest
Tests that comment settings are properly updated during database updates.

Namespace

Drupal\Tests\comment\Functional\Update

Code

public function testOwnerEntityKey() {
    // Check that the 'owner' entity key does not exist prior to the update.
    $entity_type = \Drupal::entityDefinitionUpdateManager()->getEntityType('comment');
    $this->assertFalse($entity_type->getKey('owner'));
    // Run updates.
    $this->runUpdates();
    // Check that the entity key exists and it has the correct value.
    $entity_type = \Drupal::entityDefinitionUpdateManager()->getEntityType('comment');
    $this->assertEquals('uid', $entity_type->getKey('owner'));
}

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