function NodeUpdateTest::testOwnerEntityKey
Tests that the node entity type has an 'owner' entity key.
See also
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\UpdateCode
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'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.