You are here

public function ContentModerationUpdateTest::testOwnerEntityKey in Drupal 8

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'));
}