function ContentModerationUpdateTest::testOwnerEntityKey

Tests that the content moderation state entity has an 'owner' entity key.

See also

content_moderation_update_8700()

File

core/modules/content_moderation/tests/src/Functional/Update/ContentModerationUpdateTest.php, line 30

Class

ContentModerationUpdateTest
Tests that content moderation settings are updated during database updates.

Namespace

Drupal\Tests\content_moderation\Functional\Update

Code

public function testOwnerEntityKey() {
    // Check that the 'owner' entity key does not exist prior to the update.
    $entity_type = \Drupal::entityDefinitionUpdateManager()->getEntityType('content_moderation_state');
    $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('content_moderation_state');
    $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.