You are here

public function MediaUpdateTest::testOwnerEntityKey in Drupal 8

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

See also

media_update_8700()

File

core/modules/media/tests/src/Functional/Update/MediaUpdateTest.php, line 74

Class

MediaUpdateTest
Tests that media settings are properly updated during database updates.

Namespace

Drupal\Tests\media\Functional\Update

Code

public function testOwnerEntityKey() {

  // Check that the 'owner' entity key does not exist prior to the update.
  $entity_type = \Drupal::entityDefinitionUpdateManager()
    ->getEntityType('media');
  $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('media');
  $this
    ->assertEquals('uid', $entity_type
    ->getKey('owner'));
}