You are here

public function NodeUpdateTest::testOwnerEntityKey in Drupal 8

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

See also

node_update_8700()

File

core/modules/node/tests/src/Functional/Update/NodeUpdateTest.php, line 73

Class

NodeUpdateTest
Tests that node settings are properly updated during database updates.

Namespace

Drupal\Tests\node\Functional\Update

Code

public function testOwnerEntityKey() {

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