You are here

public function FileUpdateTest::testOwnerEntityKey in Drupal 8

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

See also

file_update_8700()

File

core/modules/file/tests/src/Functional/Update/FileUpdateTest.php, line 64

Class

FileUpdateTest
Tests File update path.

Namespace

Drupal\Tests\file\Functional\Update

Code

public function testOwnerEntityKey() {

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