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