Commit 55005901 authored by catch's avatar catch

Issue #3099789 by amateescu, Berdir, hchonov, catch, alexpott: Remove the BC...

Issue #3099789 by amateescu, Berdir, hchonov, catch, alexpott: Remove the BC layer for revision metadata keys
parent fe076507
......@@ -14,18 +14,6 @@ class ContentEntityType extends EntityType implements ContentEntityTypeInterface
*/
protected $revision_metadata_keys = [];
/**
* The required revision metadata keys.
*
* This property should only be filled in the constructor. This ensures that
* only new instances get newly added required revision metadata keys.
* Unserialized objects will only retrieve the keys that they already have
* been cached with.
*
* @var array
*/
protected $requiredRevisionMetadataKeys = [];
/**
* {@inheritdoc}
*/
......@@ -37,23 +25,9 @@ public function __construct($definition) {
'view_builder' => 'Drupal\Core\Entity\EntityViewBuilder',
];
// Only new instances should provide the required revision metadata keys.
// The cached instances should return only what already has been stored
// under the property $revision_metadata_keys. The BC layer in
// ::getRevisionMetadataKeys() has to detect if the revision metadata keys
// have been provided by the entity type annotation, therefore we add keys
// to the property $requiredRevisionMetadataKeys only if those keys aren't
// set in the entity type annotation.
if (!isset($this->revision_metadata_keys['revision_default'])) {
$this->requiredRevisionMetadataKeys['revision_default'] = 'revision_default';
}
// Add the required revision metadata fields here instead in the getter
// method, so that they are serialized as part of the object even if the
// getter method doesn't get called. This allows the list to be further
// extended. Only new instances of the class will contain the new list,
// while the cached instances contain the previous version of the list.
$this->revision_metadata_keys += $this->requiredRevisionMetadataKeys;
$this->revision_metadata_keys += [
'revision_default' => 'revision_default',
];
}
/**
......@@ -82,24 +56,7 @@ protected function checkStorageClass($class) {
/**
* {@inheritdoc}
*/
public function getRevisionMetadataKeys($include_backwards_compatibility_field_names = TRUE) {
// Provide backwards compatibility in case the revision metadata keys are
// not defined in the entity annotation.
if ((!$this->revision_metadata_keys || ($this->revision_metadata_keys == $this->requiredRevisionMetadataKeys)) && $include_backwards_compatibility_field_names) {
$base_fields = \Drupal::service('entity_field.manager')->getBaseFieldDefinitions($this->id());
if ((isset($base_fields['revision_uid']) && $revision_user = 'revision_uid') || (isset($base_fields['revision_user']) && $revision_user = 'revision_user')) {
@trigger_error('The revision_user revision metadata key is not set for entity type: ' . $this->id . ' See: https://www.drupal.org/node/2831499', E_USER_DEPRECATED);
$this->revision_metadata_keys['revision_user'] = $revision_user;
}
if ((isset($base_fields['revision_timestamp']) && $revision_timestamp = 'revision_timestamp') || (isset($base_fields['revision_created'])) && $revision_timestamp = 'revision_created') {
@trigger_error('The revision_created revision metadata key is not set for entity type: ' . $this->id . ' See: https://www.drupal.org/node/2831499', E_USER_DEPRECATED);
$this->revision_metadata_keys['revision_created'] = $revision_timestamp;
}
if ((isset($base_fields['revision_log']) && $revision_log = 'revision_log') || (isset($base_fields['revision_log_message']) && $revision_log = 'revision_log_message')) {
@trigger_error('The revision_log_message revision metadata key is not set for entity type: ' . $this->id . ' See: https://www.drupal.org/node/2831499', E_USER_DEPRECATED);
$this->revision_metadata_keys['revision_log_message'] = $revision_log;
}
}
public function getRevisionMetadataKeys() {
return $this->revision_metadata_keys;
}
......@@ -119,4 +76,17 @@ public function hasRevisionMetadataKey($key) {
return isset($keys[$key]);
}
/**
* {@inheritdoc}
*/
public function setRevisionMetadataKey($key, $field_name) {
if ($field_name !== NULL) {
$this->revision_metadata_keys[$key] = $field_name;
}
else {
unset($this->revision_metadata_keys[$key]);
}
return $this;
}
}
......@@ -10,12 +10,6 @@ interface ContentEntityTypeInterface extends EntityTypeInterface {
/**
* Gets an array of entity revision metadata keys.
*
* @param bool $include_backwards_compatibility_field_names
* (optional and deprecated) Whether to provide the revision keys on a
* best-effort basis by looking at the base fields defined by the entity
* type. Note that this parameter will be removed in Drupal 9.0.0. Defaults
* to TRUE.
*
* @return array
* An array describing how the Field API can extract revision metadata
* information of this entity type:
......@@ -26,7 +20,7 @@ interface ContentEntityTypeInterface extends EntityTypeInterface {
* - revision_created: The name of the property that contains the timestamp
* of the current revision.
*/
public function getRevisionMetadataKeys($include_backwards_compatibility_field_names = TRUE);
public function getRevisionMetadataKeys();
/**
* Gets a specific entity revision metadata key.
......@@ -52,4 +46,17 @@ public function getRevisionMetadataKey($key);
*/
public function hasRevisionMetadataKey($key);
/**
* Sets a revision metadata key.
*
* @param string $key
* The name of the entity revision metadata key to set.
* @param string|null $field_name
* The name of the entity field key to use for the revision metadata key. If
* NULL is passed, the value of the revision metadata key is unset.
*
* @return $this
*/
public function setRevisionMetadataKey($key, $field_name);
}
......@@ -232,9 +232,7 @@ protected function buildBaseFieldDefinitions($entity_type_id) {
// Make sure that revisionable entity types are correctly defined.
if ($entity_type->isRevisionable()) {
// Disable the BC layer to prevent a recursion, this only needs the
// revision_default key that is always set.
$field_name = $entity_type->getRevisionMetadataKeys(FALSE)['revision_default'];
$field_name = $entity_type->getRevisionMetadataKey('revision_default');
$base_field_definitions[$field_name] = BaseFieldDefinition::create('boolean')
->setLabel($this->t('Default revision'))
->setDescription($this->t('A flag indicating whether this was a default revision when it was saved.'))
......
......@@ -2,6 +2,7 @@
namespace Drupal\Core\Entity;
use Drupal\Core\Entity\Exception\UnsupportedEntityTypeDefinitionException;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\user\UserInterface;
......@@ -25,18 +26,28 @@ trait RevisionLogEntityTrait {
* @see \Drupal\Core\Entity\FieldableEntityInterface::baseFieldDefinitions()
*/
public static function revisionLogBaseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields[static::getRevisionMetadataKey($entity_type, 'revision_created')] = BaseFieldDefinition::create('created')
if (!($entity_type instanceof ContentEntityTypeInterface)) {
throw new UnsupportedEntityTypeDefinitionException('The entity type ' . $entity_type->id() . ' is not a content entity type.');
}
foreach (['revision_created', 'revision_user', 'revision_log_message'] as $revision_metadata_key) {
if (!$entity_type->hasRevisionMetadataKey($revision_metadata_key)) {
throw new UnsupportedEntityTypeDefinitionException('The entity type ' . $entity_type->id() . ' does not have an "' . $revision_metadata_key . '" entity revision metadata key.');
}
}
$fields[$entity_type->getRevisionMetadataKey('revision_created')] = BaseFieldDefinition::create('created')
->setLabel(t('Revision create time'))
->setDescription(t('The time that the current revision was created.'))
->setRevisionable(TRUE);
$fields[static::getRevisionMetadataKey($entity_type, 'revision_user')] = BaseFieldDefinition::create('entity_reference')
$fields[$entity_type->getRevisionMetadataKey('revision_user')] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Revision user'))
->setDescription(t('The user ID of the author of the current revision.'))
->setSetting('target_type', 'user')
->setRevisionable(TRUE);
$fields[static::getRevisionMetadataKey($entity_type, 'revision_log_message')] = BaseFieldDefinition::create('string_long')
$fields[$entity_type->getRevisionMetadataKey('revision_log_message')] = BaseFieldDefinition::create('string_long')
->setLabel(t('Revision log message'))
->setDescription(t('Briefly describe the changes you have made.'))
->setRevisionable(TRUE)
......@@ -56,14 +67,14 @@ public static function revisionLogBaseFieldDefinitions(EntityTypeInterface $enti
* Implements \Drupal\Core\Entity\RevisionLogInterface::getRevisionCreationTime().
*/
public function getRevisionCreationTime() {
return $this->{static::getRevisionMetadataKey($this->getEntityType(), 'revision_created')}->value;
return $this->{$this->getEntityType()->getRevisionMetadataKey('revision_created')}->value;
}
/**
* Implements \Drupal\Core\Entity\RevisionLogInterface::setRevisionCreationTime().
*/
public function setRevisionCreationTime($timestamp) {
$this->{static::getRevisionMetadataKey($this->getEntityType(), 'revision_created')}->value = $timestamp;
$this->{$this->getEntityType()->getRevisionMetadataKey('revision_created')}->value = $timestamp;
return $this;
}
......@@ -71,14 +82,14 @@ public function setRevisionCreationTime($timestamp) {
* Implements \Drupal\Core\Entity\RevisionLogInterface::getRevisionUser().
*/
public function getRevisionUser() {
return $this->{static::getRevisionMetadataKey($this->getEntityType(), 'revision_user')}->entity;
return $this->{$this->getEntityType()->getRevisionMetadataKey('revision_user')}->entity;
}
/**
* Implements \Drupal\Core\Entity\RevisionLogInterface::setRevisionUser().
*/
public function setRevisionUser(UserInterface $account) {
$this->{static::getRevisionMetadataKey($this->getEntityType(), 'revision_user')}->entity = $account;
$this->{$this->getEntityType()->getRevisionMetadataKey('revision_user')}->entity = $account;
return $this;
}
......@@ -86,14 +97,14 @@ public function setRevisionUser(UserInterface $account) {
* Implements \Drupal\Core\Entity\RevisionLogInterface::getRevisionUserId().
*/
public function getRevisionUserId() {
return $this->{static::getRevisionMetadataKey($this->getEntityType(), 'revision_user')}->target_id;
return $this->{$this->getEntityType()->getRevisionMetadataKey('revision_user')}->target_id;
}
/**
* Implements \Drupal\Core\Entity\RevisionLogInterface::setRevisionUserId().
*/
public function setRevisionUserId($user_id) {
$this->{static::getRevisionMetadataKey($this->getEntityType(), 'revision_user')}->target_id = $user_id;
$this->{$this->getEntityType()->getRevisionMetadataKey('revision_user')}->target_id = $user_id;
return $this;
}
......@@ -101,14 +112,14 @@ public function setRevisionUserId($user_id) {
* Implements \Drupal\Core\Entity\RevisionLogInterface::getRevisionLogMessage().
*/
public function getRevisionLogMessage() {
return $this->{static::getRevisionMetadataKey($this->getEntityType(), 'revision_log_message')}->value;
return $this->{$this->getEntityType()->getRevisionMetadataKey('revision_log_message')}->value;
}
/**
* Implements \Drupal\Core\Entity\RevisionLogInterface::setRevisionLogMessage().
*/
public function setRevisionLogMessage($revision_log_message) {
$this->{static::getRevisionMetadataKey($this->getEntityType(), 'revision_log_message')}->value = $revision_log_message;
$this->{$this->getEntityType()->getRevisionMetadataKey('revision_log_message')}->value = $revision_log_message;
return $this;
}
......@@ -125,17 +136,17 @@ public function setRevisionLogMessage($revision_log_message) {
* The name of the field for the specified $key.
*/
protected static function getRevisionMetadataKey(EntityTypeInterface $entity_type, $key) {
// We need to prevent ContentEntityType::getRevisionMetadataKey() from
// providing fallback as that requires fetching the entity type's field
// definition leading to an infinite recursion.
@trigger_error(static::class . 'getRevisionMetadataKey() is deprecated in drupal:9.0.0 and is removed from drupal:10.0.0. Use $entity_type->getRevisionMetadataKey() instead. See: https://www.drupal.org/node/2831499', E_USER_DEPRECATED);
/** @var \Drupal\Core\Entity\ContentEntityTypeInterface $entity_type */
$revision_metadata_keys = $entity_type->getRevisionMetadataKeys(FALSE) + [
'revision_created' => 'revision_created',
'revision_user' => 'revision_user',
'revision_log_message' => 'revision_log_message',
];
return $revision_metadata_keys[$key];
return $entity_type->getRevisionMetadataKey($key);
}
/**
* Gets the entity type definition.
*
* @return \Drupal\Core\Entity\ContentEntityTypeInterface
* The content entity type definition.
*/
abstract public function getEntityType();
}
......@@ -14,6 +14,7 @@
use Drupal\Core\Cache\Cache;
use Drupal\Core\Database\Query\AlterableInterface;
use Drupal\Core\Extension\Extension;
use Drupal\Core\Entity\ContentEntityTypeInterface;
use Drupal\Core\File\Exception\FileException;
use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\Form\FormStateInterface;
......@@ -1243,10 +1244,8 @@ function system_modules_uninstalled($modules) {
$entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();
foreach ($entity_definition_update_manager->getEntityTypes() as $entity_type) {
$revision_metadata_keys = $entity_type->get('revision_metadata_keys');
if ($revision_metadata_keys && array_key_exists('workspace', $revision_metadata_keys)) {
unset($revision_metadata_keys['workspace']);
$entity_type->set('revision_metadata_keys', $revision_metadata_keys);
if ($entity_type instanceof ContentEntityTypeInterface && $entity_type->hasRevisionMetadataKey('workspace')) {
$entity_type->setRevisionMetadataKey('workspace', NULL);
$entity_definition_update_manager->updateEntityType($entity_type);
}
}
......
......@@ -6,10 +6,13 @@
*/
use Drupal\Core\Config\Entity\ConfigEntityUpdater;
use Drupal\Core\Entity\ContentEntityType;
use Drupal\Core\Entity\ContentEntityTypeInterface;
use Drupal\Core\Entity\Display\EntityDisplayInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\Plugin\Field\FieldWidget\EntityReferenceAutocompleteWidget;
/**
......@@ -285,3 +288,31 @@ function system_post_update_uninstall_simpletest() {
function system_post_update_uninstall_entity_reference_module() {
\Drupal::service('module_installer')->uninstall(['entity_reference']);
}
/**
* Remove backwards-compatibility leftovers from entity type definitions.
*/
function system_post_update_entity_revision_metadata_bc_cleanup() {
/** @var \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface $last_installed_schema_repository */
$last_installed_schema_repository = \Drupal::service('entity.last_installed_schema.repository');
// Get a list of content entity types.
/** @var \Drupal\Core\Entity\EntityTypeInterface[] $last_installed_definitions */
$last_installed_definitions = array_filter($last_installed_schema_repository->getLastInstalledDefinitions(), function (EntityTypeInterface $entity_type) {
return $entity_type instanceof ContentEntityTypeInterface;
});
// Remove the '$requiredRevisionMetadataKeys' property for these entity types.
foreach ($last_installed_definitions as $entity_type_id => $entity_type) {
$closure = function (ContentEntityTypeInterface $entity_type) {
return get_object_vars($entity_type);
};
$closure = \Closure::bind($closure, NULL, $entity_type);
$entity_type_definition = $closure($entity_type);
unset($entity_type_definition["\x00*\x00requiredRevisionMetadataKeys"]);
$entity_type = new ContentEntityType($entity_type_definition);
$last_installed_schema_repository->setLastInstalledDefinition($entity_type);
}
}
......@@ -26,12 +26,8 @@ function entity_schema_test_entity_type_alter(array &$entity_types) {
$keys = $entity_type->getKeys();
$keys['revision'] = 'revision_id';
$entity_type->set('entity_keys', $keys);
// We can't use getRevisionMetadataKeys() because it causes recursion.
$revision_metadata_keys = $entity_type->get('revision_metadata_keys');
$revision_metadata_keys = array_merge($revision_metadata_keys, [
'revision_log_message' => 'revision_log',
]);
$entity_type->set('revision_metadata_keys', $revision_metadata_keys);
$entity_type->setRevisionMetadataKey('revision_log_message', 'revision_log');
}
}
}
......
......@@ -5,9 +5,6 @@
/**
* Defines the test entity class.
*
* This entity type does not define revision_metadata_keys on purpose to test
* the BC layer.
*
* @ContentEntityType(
* id = "entity_test_mul_revlog",
* label = @Translation("Test entity - data table, revisions log"),
......@@ -24,6 +21,11 @@
* "label" = "name",
* "langcode" = "langcode",
* },
* revision_metadata_keys = {
* "revision_user" = "revision_user",
* "revision_created" = "revision_created",
* "revision_log_message" = "revision_log_message"
* },
* )
*/
class EntityTestMulWithRevisionLog extends EntityTestWithRevisionLog {
......
<?php
namespace Drupal\entity_test_revlog\Entity;
use Drupal\Core\Entity\EntityPublishedInterface;
use Drupal\Core\Entity\EntityPublishedTrait;
use Drupal\Core\Entity\EntityTypeInterface;
/**
* Defines the test entity class.
*
* @ContentEntityType(
* id = "entity_test_mul_revlog_pub",
* label = @Translation("Test entity - data table, revisions log, publishing status"),
* base_table = "entity_test_mul_revlog_pub",
* data_table = "entity_test_mul_revlog_pub_field_data",
* revision_table = "entity_test_mul_revlog_pub_revision",
* revision_data_table = "entity_test_mul_revlog_pub_field_revision",
* translatable = TRUE,
* entity_keys = {
* "id" = "id",
* "uuid" = "uuid",
* "revision" = "revision_id",
* "bundle" = "type",
* "label" = "name",
* "langcode" = "langcode",
* "published" = "status",
* },
* revision_metadata_keys = {
* "revision_user" = "revision_user",
* "revision_created" = "revision_created",
* "revision_log_message" = "revision_log_message"
* },
* )
*/
class EntityTestMulWithRevisionLogPub extends EntityTestWithRevisionLog implements EntityPublishedInterface {
use EntityPublishedTrait;
/**
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
return parent::baseFieldDefinitions($entity_type) + EntityPublishedTrait::publishedBaseFieldDefinitions($entity_type);
}
}
<?php
namespace Drupal\Tests\system\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
/**
* Tests the upgrade path for removing the revision metadata BC layer.
*
* @see https://www.drupal.org/node/3099789
*
* @group Update
* @group legacy
*/
class RemoveRevisionMetadataBcLayerUpdateTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../fixtures/update/drupal-8.8.0.bare.standard.php.gz',
];
}
/**
* @see system_post_update_entity_revision_metadata_bc_cleanup()
*/
public function testRevisionMetadataBcLayerRemoval() {
$entity_type = \Drupal::service('entity.last_installed_schema.repository')->getLastInstalledDefinition('node');
$this->assertArrayHasKey("\x00*\x00requiredRevisionMetadataKeys", (array) $entity_type);
$this->runUpdates();
$entity_type = \Drupal::service('entity.last_installed_schema.repository')->getLastInstalledDefinition('node');
$this->assertArrayNotHasKey("\x00*\x00requiredRevisionMetadataKeys", (array) $entity_type);
}
}
......@@ -69,10 +69,7 @@ public function entityTypeBuild(array &$entity_types) {
foreach ($entity_types as $entity_type) {
if ($this->workspaceManager->isEntityTypeSupported($entity_type)) {
$entity_type->addConstraint('EntityWorkspaceConflict');
$revision_metadata_keys = $entity_type->get('revision_metadata_keys');
$revision_metadata_keys['workspace'] = 'workspace';
$entity_type->set('revision_metadata_keys', $revision_metadata_keys);
$entity_type->setRevisionMetadataKey('workspace', 'workspace');
}
}
}
......
......@@ -99,12 +99,9 @@ public function onEntityTypeUpdate(EntityTypeInterface $entity_type, EntityTypeI
$field_storage_definition = $this->entityLastInstalledSchemaRepository->getLastInstalledFieldStorageDefinitions($entity_type->id())[$revision_metadata_keys['workspace']];
$this->entityDefinitionUpdateManager->uninstallFieldStorageDefinition($field_storage_definition);
$revision_metadata_keys = $entity_type->get('revision_metadata_keys');
unset($revision_metadata_keys['workspace']);
$entity_type->set('revision_metadata_keys', $revision_metadata_keys);
// We are only removing a revision metadata key so we don't need to go
// through the entity update process.
$entity_type->setRevisionMetadataKey('workspace', NULL);
$this->entityLastInstalledSchemaRepository->setLastInstalledDefinition($entity_type);
}
}
......@@ -130,23 +127,19 @@ public function onEntityTypeDelete(EntityTypeInterface $entity_type) {
* The entity type that has been installed or updated.
*/
protected function addRevisionMetadataField(EntityTypeInterface $entity_type) {
$revision_metadata_keys = $entity_type->get('revision_metadata_keys');
if (!isset($revision_metadata_keys['workspace'])) {
if (!$entity_type->hasRevisionMetadataKey('workspace')) {
// Bail out if there's an existing field called 'workspace'.
if ($this->entityDefinitionUpdateManager->getFieldStorageDefinition('workspace', $entity_type->id())) {
throw new \RuntimeException("An existing 'workspace' field was found for the '{$entity_type->id()}' entity type. Set the 'workspace' revision metadata key to use a different field name and run this update function again.");
}
$revision_metadata_keys['workspace'] = 'workspace';
$entity_type->set('revision_metadata_keys', $revision_metadata_keys);
// We are only adding a revision metadata key so we don't need to go
// through the entity update process.
$entity_type->setRevisionMetadataKey('workspace', 'workspace');
$this->entityLastInstalledSchemaRepository->setLastInstalledDefinition($entity_type);
}
$this->entityDefinitionUpdateManager->installFieldStorageDefinition($revision_metadata_keys['workspace'], $entity_type->id(), 'workspaces', $this->getWorkspaceFieldDefinition());
$this->entityDefinitionUpdateManager->installFieldStorageDefinition($entity_type->getRevisionMetadataKey('workspace'), $entity_type->id(), 'workspaces', $this->getWorkspaceFieldDefinition());
}
/**
......
......@@ -45,7 +45,8 @@ public function testUninstallingWorkspace() {
$this->assertFalse(\Drupal::database()->schema()->fieldExists('node_revision', 'workspace'));
// Verify that the revision metadata key has been removed.
$revision_metadata_keys = \Drupal::entityDefinitionUpdateManager()->getEntityType('node')->get('revision_metadata_keys');
$entity_type = \Drupal::entityDefinitionUpdateManager()->getEntityType('node');
$revision_metadata_keys = $entity_type->get('revision_metadata_keys');
$this->assertArrayNotHasKey('workspace', $revision_metadata_keys);
}
......
......@@ -42,8 +42,7 @@ function workspaces_module_preinstall($module) {
foreach ($entity_definition_update_manager->getEntityTypes() as $entity_type) {
$revision_metadata_keys = $entity_type->get('revision_metadata_keys');
if ($workspace_manager->isEntityTypeSupported($entity_type)) {
$revision_metadata_keys['workspace'] = 'workspace';
$entity_type->set('revision_metadata_keys', $revision_metadata_keys);
$entity_type->setRevisionMetadataKey('workspace', 'workspace');
$entity_definition_update_manager->updateEntityType($entity_type);
}
}
......
......@@ -17,7 +17,6 @@
*
* @coversDefaultClass \Drupal\Core\Entity\RevisionableContentEntityBase
* @group Entity
* @group legacy
*/
class RevisionableContentEntityBaseTest extends EntityKernelTestBase {
......@@ -36,17 +35,13 @@ protected function setUp() {
/**
* Tests the correct functionality CRUD operations of entity revisions.
*
* @expectedDeprecation The revision_user revision metadata key is not set for entity type: entity_test_mul_revlog See: https://www.drupal.org/node/2831499
* @expectedDeprecation The revision_created revision metadata key is not set for entity type: entity_test_mul_revlog See: https://www.drupal.org/node/2831499
* @expectedDeprecation The revision_log_message revision metadata key is not set for entity type: entity_test_mul_revlog See: https://www.drupal.org/node/2831499
*/
public function testRevisionableContentEntity() {
$entity_type = 'entity_test_mul_revlog';
$definition = \Drupal::entityTypeManager()->getDefinition($entity_type);
$user = User::create(['name' => 'test name']);
$user->save();
/** @var \Drupal\entity_test_mul_revlog\Entity\EntityTestMulWithRevisionLog $entity */
/** @var \Drupal\entity_test_revlog\Entity\EntityTestMulWithRevisionLog $entity */
$entity = EntityTestMulWithRevisionLog::create([
'type' => $entity_type,
]);
......@@ -100,10 +95,6 @@ public function testRevisionableContentEntity() {
* Tests the behavior of the "revision_default" flag.
*
* @covers \Drupal\Core\Entity\ContentEntityBase::wasDefaultRevision
*
* @expectedDeprecation The revision_user revision metadata key is not set for entity type: entity_test_mul_revlog See: https://www.drupal.org/node/2831499
* @expectedDeprecation The revision_created revision metadata key is not set for entity type: entity_test_mul_revlog See: https://www.drupal.org/node/2831499
* @expectedDeprecation The revision_log_message revision metadata key is not set for entity type: entity_test_mul_revlog See: https://www.drupal.org/node/2831499
*/
public function testWasDefaultRevision() {
$entity_type_id = 'entity_test_mul_revlog';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment