diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
index 86456934f75..90cd3760529 100644
--- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
+++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
@@ -374,31 +374,6 @@ abstract class ConfigEntityBase extends EntityBase implements ConfigEntityInterf
return $this;
}
- /**
- * {@inheritdoc}
- */
- public function urlInfo($rel = 'edit-form', array $options = []) {
- // Unless language was already provided, avoid setting an explicit language.
- $options += ['language' => NULL];
- return parent::urlInfo($rel, $options);
- }
-
- /**
- * {@inheritdoc}
- */
- public function url($rel = 'edit-form', $options = []) {
- // Do not remove this override: the default value of $rel is different.
- return parent::url($rel, $options);
- }
-
- /**
- * {@inheritdoc}
- */
- public function link($text = NULL, $rel = 'edit-form', array $options = []) {
- // Do not remove this override: the default value of $rel is different.
- return parent::link($text, $rel, $options);
- }
-
/**
* {@inheritdoc}
*/
diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php
index 5ca737ffbf3..8e85d4c0573 100644
--- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php
+++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php
@@ -1244,16 +1244,9 @@ abstract class ContentEntityBase extends EntityBase implements \IteratorAggregat
* {@inheritdoc}
*/
public function label() {
- $label = NULL;
- $entity_type = $this->getEntityType();
- if (($label_callback = $entity_type->get('label_callback')) && is_callable($label_callback)) {
- @trigger_error('Entity type ' . $this->getEntityTypeId() . ' defines a label callback. Support for that is deprecated in drupal:8.0.0 and will be removed in drupal:9.0.0. Override the EntityInterface::label() method instead. See https://www.drupal.org/node/3050794', E_USER_DEPRECATED);
- $label = call_user_func($label_callback, $this);
+ if ($this->getEntityType()->getKey('label')) {
+ return $this->getEntityKey('label');
}
- elseif (($label_key = $entity_type->getKey('label'))) {
- $label = $this->getEntityKey('label');
- }
- return $label;
}
/**
diff --git a/core/lib/Drupal/Core/Entity/ContentEntityNullStorage.php b/core/lib/Drupal/Core/Entity/ContentEntityNullStorage.php
index 94efc1186b0..1a72442e6dd 100644
--- a/core/lib/Drupal/Core/Entity/ContentEntityNullStorage.php
+++ b/core/lib/Drupal/Core/Entity/ContentEntityNullStorage.php
@@ -86,7 +86,8 @@ class ContentEntityNullStorage extends ContentEntityStorageBase {
/**
* {@inheritdoc}
*/
- protected function doLoadRevisionFieldItems($revision_id) {
+ protected function doLoadMultipleRevisionsFieldItems($revision_ids) {
+ return [];
}
/**
diff --git a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
index 080511bb50c..833d22d3fa8 100644
--- a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
+++ b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
@@ -580,45 +580,13 @@ abstract class ContentEntityStorageBase extends EntityStorageBase implements Con
/**
* Actually loads revision field item values from the storage.
*
- * @param int|string $revision_id
- * The revision identifier.
- *
- * @return \Drupal\Core\Entity\EntityInterface|null
- * The specified entity revision or NULL if not found.
- *
- * @deprecated in drupal:8.5.0 and is removed from drupal:9.0.0.
- * \Drupal\Core\Entity\ContentEntityStorageBase::doLoadMultipleRevisionsFieldItems()
- * should be implemented instead.
- *
- * @see https://www.drupal.org/node/2924915
- */
- abstract protected function doLoadRevisionFieldItems($revision_id);
-
- /**
- * Actually loads revision field item values from the storage.
- *
- * This method should always be overridden and not called either directly or
- * from parent::doLoadMultipleRevisionsFieldItems. It will be marked abstract
- * in drupal:9.0.0
- *
* @param array $revision_ids
* An array of revision identifiers.
*
* @return \Drupal\Core\Entity\EntityInterface[]
* The specified entity revisions or an empty array if none are found.
- *
- * @todo Remove this logic and make the method abstract in
- * https://www.drupal.org/project/drupal/issues/3069696
*/
- protected function doLoadMultipleRevisionsFieldItems($revision_ids) {
- @trigger_error('Calling ' . __NAMESPACE__ . 'ContentEntityStorageBase::doLoadMultipleRevisionsFieldItems() directly is deprecated in drupal:8.8.0 and the method will be made abstract in drupal:9.0.0. Storage implementations should override and implement their own loading logic. See https://www.drupal.org/node/3069692', E_USER_DEPRECATED);
- $revisions = [];
- foreach ($revision_ids as $revision_id) {
- $revisions[] = $this->doLoadRevisionFieldItems($revision_id);
- }
-
- return $revisions;
- }
+ abstract protected function doLoadMultipleRevisionsFieldItems($revision_ids);
/**
* {@inheritdoc}
diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php
deleted file mode 100644
index 8a504d46f64..00000000000
--- a/core/lib/Drupal/Core/Entity/Entity.php
+++ /dev/null
@@ -1,15 +0,0 @@
-getEntityType();
- if (($label_callback = $entity_type->get('label_callback')) && is_callable($label_callback)) {
- @trigger_error('Entity type ' . $this->getEntityTypeId() . ' defines a label callback. Support for that is deprecated in drupal:8.0.0 and will be removed in drupal:9.0.0. Override the EntityInterface::label() method instead. See https://www.drupal.org/node/3050794', E_USER_DEPRECATED);
- $label = call_user_func($label_callback, $this);
+ if (($label_key = $this->getEntityType()->getKey('label')) && isset($this->{$label_key})) {
+ return $this->{$label_key};
}
- elseif (($label_key = $entity_type->getKey('label')) && isset($this->{$label_key})) {
- $label = $this->{$label_key};
- }
- return $label;
- }
-
- /**
- * {@inheritdoc}
- */
- public function urlInfo($rel = 'canonical', array $options = []) {
- @trigger_error('EntityInterface::urlInfo() is deprecated in Drupal 8.0.0 and will be removed in Drupal 9.0.0. EntityInterface::toUrl() instead. See https://www.drupal.org/node/2614344', E_USER_DEPRECATED);
- return $this->toUrl($rel, $options);
}
/**
@@ -249,14 +234,6 @@ abstract class EntityBase implements EntityInterface {
return $this->getEntityType()->getLinkTemplates();
}
- /**
- * {@inheritdoc}
- */
- public function link($text = NULL, $rel = 'canonical', array $options = []) {
- @trigger_error("EntityInterface::link() is deprecated in Drupal 8.0.0 and will be removed in Drupal 9.0.0. Use EntityInterface::toLink()->toString() instead. Note, the default relationship for configuration entities changes from 'edit-form' to 'canonical'. See https://www.drupal.org/node/2614344", E_USER_DEPRECATED);
- return $this->toLink($text, $rel, $options)->toString();
- }
-
/**
* {@inheritdoc}
*/
@@ -270,23 +247,6 @@ abstract class EntityBase implements EntityInterface {
return new Link($text, $url);
}
- /**
- * {@inheritdoc}
- */
- public function url($rel = 'canonical', $options = []) {
- @trigger_error('EntityInterface::url() is deprecated in Drupal 8.0.0 and will be removed in Drupal 9.0.0. EntityInterface::toUrl() instead. Note, a \Drupal\Core\Url object is returned. See https://www.drupal.org/node/2614344', E_USER_DEPRECATED);
- // While self::toUrl() will throw an exception if the entity has no id,
- // the expected result for a URL is always a string.
- if ($this->id() === NULL || !$this->hasLinkTemplate($rel)) {
- return '';
- }
-
- $uri = $this->toUrl($rel);
- $options += $uri->getOptions();
- $uri->setOptions($options);
- return $uri->toString();
- }
-
/**
* Gets an array of placeholders for this entity.
*
diff --git a/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManagerInterface.php b/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManagerInterface.php
index 3189edf083e..55942c09899 100644
--- a/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManagerInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManagerInterface.php
@@ -97,26 +97,6 @@ interface EntityDefinitionUpdateManagerInterface {
*/
public function getChangeList();
- /**
- * Applies all the detected valid changes.
- *
- * Use this with care, as it will apply updates for any module, which will
- * lead to unpredictable results.
- *
- * @throws \Drupal\Core\Entity\EntityStorageException
- * This exception is thrown if a change cannot be applied without
- * unacceptable data loss. In such a case, the site administrator needs to
- * apply some other process, such as a custom update function or a
- * migration via the Migrate module.
- *
- * @deprecated in drupal:8.7.0 and is removed from drupal:9.0.0. Use
- * \Drupal\Core\Entity\EntityDefinitionUpdateManagerInterface::getChangeList()
- * and execute each entity type and field storage update manually instead.
- *
- * @see https://www.drupal.org/node/3034742
- */
- public function applyUpdates();
-
/**
* Returns an entity type definition ready to be manipulated.
*
diff --git a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php
index 3df078a06bf..672fc073e2c 100644
--- a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php
+++ b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php
@@ -183,12 +183,6 @@ abstract class EntityDisplayBase extends ConfigEntityBase implements EntityDispl
if (!$definition->isDisplayConfigurable($this->displayContext) || (!isset($this->content[$name]) && !isset($this->hidden[$name]))) {
$options = $definition->getDisplayOptions($this->displayContext);
- // @todo Remove handling of 'type' in https://www.drupal.org/node/2799641.
- if (!isset($options['region']) && !empty($options['type']) && $options['type'] === 'hidden') {
- $options['region'] = 'hidden';
- @trigger_error("Support for using 'type' => 'hidden' in a component is deprecated in drupal:8.3.0 and is removed from drupal:9.0.0. Use 'region' => 'hidden' instead. See https://www.drupal.org/node/2801513", E_USER_DEPRECATED);
- }
-
if (!empty($options['region']) && $options['region'] === 'hidden') {
$this->removeComponent($name);
}
@@ -253,13 +247,6 @@ abstract class EntityDisplayBase extends ConfigEntityBase implements EntityDispl
public function preSave(EntityStorageInterface $storage) {
// Ensure that a region is set on each component.
foreach ($this->getComponents() as $name => $component) {
- // @todo Remove this BC layer in Drupal 9.
- // @see https://www.drupal.org/project/drupal/issues/2799641
- if (!isset($component['region']) && isset($component['type']) && $component['type'] === 'hidden') {
- @trigger_error("Support for using 'type' => 'hidden' in a component is deprecated in drupal:8.3.0 and is removed from drupal:9.0.0. Use 'region' => 'hidden' instead. See https://www.drupal.org/node/2801513", E_USER_DEPRECATED);
- $this->removeComponent($name);
- }
-
// Ensure that a region is set.
if (isset($this->content[$name]) && !isset($component['region'])) {
// Directly set the component to bypass other changes in setComponent().
@@ -272,29 +259,6 @@ abstract class EntityDisplayBase extends ConfigEntityBase implements EntityDispl
parent::preSave($storage);
}
- /**
- * Handles a component type of 'hidden'.
- *
- * The logic of this method has been duplicated inline in the preSave()
- * method so that this method may remain deprecated and trigger an error.
- *
- * @param string $name
- * The name of the component.
- * @param array $component
- * The component array.
- *
- * @deprecated in drupal:8.3.0 and is removed from drupal:9.0.0. No
- * replacement is provided.
- *
- * @see https://www.drupal.org/node/2801513
- */
- protected function handleHiddenType($name, array $component) {
- @trigger_error(__METHOD__ . ' is deprecated in drupal:8.3.0 and is removed from drupal:9.0.0. No replacement is provided. See https://www.drupal.org/node/2801513', E_USER_DEPRECATED);
- if (!isset($component['region']) && isset($component['type']) && $component['type'] === 'hidden') {
- $this->removeComponent($name);
- }
- }
-
/**
* {@inheritdoc}
*/
diff --git a/core/lib/Drupal/Core/Entity/EntityInterface.php b/core/lib/Drupal/Core/Entity/EntityInterface.php
index 63c56263fdf..07967d1f4c1 100644
--- a/core/lib/Drupal/Core/Entity/EntityInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityInterface.php
@@ -95,26 +95,6 @@ interface EntityInterface extends AccessibleInterface, CacheableDependencyInterf
*/
public function label();
- /**
- * Gets the URL object for the entity.
- *
- * @param string $rel
- * The link relationship type, for example: canonical or edit-form.
- * @param array $options
- * See \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute() for
- * the available options.
- *
- * @return \Drupal\Core\Url
- * The URL object.
- *
- * @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.
- * Use \Drupal\Core\Entity\EntityInterface::toUrl() instead.
- *
- * @see https://www.drupal.org/node/2614344
- * @see \Drupal\Core\Entity\EntityInterface::toUrl
- */
- public function urlInfo($rel = 'canonical', array $options = []);
-
/**
* Gets the URL object for the entity.
*
@@ -153,49 +133,6 @@ interface EntityInterface extends AccessibleInterface, CacheableDependencyInterf
*/
public function toUrl($rel = 'canonical', array $options = []);
- /**
- * Gets the public URL for this entity.
- *
- * @param string $rel
- * The link relationship type, for example: canonical or edit-form.
- * @param array $options
- * See \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute() for
- * the available options.
- *
- * @return string
- * The URL for this entity.
- *
- * @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.
- * Please use toUrl() instead.
- *
- * @see https://www.drupal.org/node/2614344
- * @see \Drupal\Core\Entity\EntityInterface::toUrl
- */
- public function url($rel = 'canonical', $options = []);
-
- /**
- * Deprecated way of generating a link to the entity. See toLink().
- *
- * @param string|null $text
- * (optional) The link text for the anchor tag as a translated string.
- * If NULL, it will use the entity's label. Defaults to NULL.
- * @param string $rel
- * (optional) The link relationship type. Defaults to 'canonical'.
- * @param array $options
- * See \Drupal\Core\Routing\UrlGeneratorInterface::generateFromRoute() for
- * the available options.
- *
- * @return string
- * An HTML string containing a link to the entity.
- *
- * @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.
- * Use \Drupal\Core\EntityInterface::toLink()->toString() instead.
- *
- * @see https://www.drupal.org/node/2614344
- * @see \Drupal\Core\Entity\EntityInterface::toLink()
- */
- public function link($text = NULL, $rel = 'canonical', array $options = []);
-
/**
* Generates the HTML for a link to this entity.
*
diff --git a/core/lib/Drupal/Core/Entity/EntityListBuilder.php b/core/lib/Drupal/Core/Entity/EntityListBuilder.php
index d07e82c3a87..82ca50ab1dc 100644
--- a/core/lib/Drupal/Core/Entity/EntityListBuilder.php
+++ b/core/lib/Drupal/Core/Entity/EntityListBuilder.php
@@ -104,23 +104,6 @@ class EntityListBuilder extends EntityHandlerBase implements EntityListBuilderIn
return $query->execute();
}
- /**
- * Gets the label of an entity.
- *
- * @param \Drupal\Core\Entity\EntityInterface $entity
- * The entity being listed.
- *
- * @return string
- * The entity label.
- *
- * @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.
- * Use $entity->label() instead. This method used to escape the entity
- * label. The render system's autoescape is now relied upon.
- */
- protected function getLabel(EntityInterface $entity) {
- return $entity->label();
- }
-
/**
* {@inheritdoc}
*/
diff --git a/core/lib/Drupal/Core/Entity/EntityPublishedInterface.php b/core/lib/Drupal/Core/Entity/EntityPublishedInterface.php
index ae3db40dc5d..6e0679bb03c 100644
--- a/core/lib/Drupal/Core/Entity/EntityPublishedInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityPublishedInterface.php
@@ -18,18 +18,11 @@ interface EntityPublishedInterface extends EntityInterface {
/**
* Sets the entity as published.
*
- * @param bool|null $published
- * (optional and deprecated) TRUE to set this entity to published, FALSE to
- * set it to unpublished. Defaults to NULL. This parameter is deprecated in
- * Drupal 8.3.0 and will be removed before Drupal 9.0.0. Use this method,
- * without any parameter, to set the entity as published and
- * setUnpublished() to set the entity as unpublished.
- *
* @return $this
*
* @see \Drupal\Core\Entity\EntityPublishedInterface::setUnpublished()
*/
- public function setPublished($published = NULL);
+ public function setPublished();
/**
* Sets the entity as unpublished.
diff --git a/core/lib/Drupal/Core/Entity/EntityPublishedTrait.php b/core/lib/Drupal/Core/Entity/EntityPublishedTrait.php
index 1f36625828e..d8056346a9e 100644
--- a/core/lib/Drupal/Core/Entity/EntityPublishedTrait.php
+++ b/core/lib/Drupal/Core/Entity/EntityPublishedTrait.php
@@ -51,16 +51,9 @@ trait EntityPublishedTrait {
/**
* {@inheritdoc}
*/
- public function setPublished($published = NULL) {
- if ($published !== NULL) {
- @trigger_error('The $published parameter is deprecated since version 8.3.x and will be removed in 9.0.0.', E_USER_DEPRECATED);
- $value = (bool) $published;
- }
- else {
- $value = TRUE;
- }
+ public function setPublished() {
$key = $this->getEntityType()->getKey('published');
- $this->set($key, $value);
+ $this->set($key, TRUE);
return $this;
}
diff --git a/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginBase.php b/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginBase.php
index 0311ea94b08..29b683f972f 100644
--- a/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginBase.php
+++ b/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionPluginBase.php
@@ -35,8 +35,6 @@ abstract class SelectionPluginBase extends PluginBase implements SelectionInterf
public function defaultConfiguration() {
return [
'target_type' => NULL,
- // @todo Remove this key in Drupal 9.0.x.
- 'handler' => $this->getPluginId(),
'entity' => NULL,
];
}
@@ -52,17 +50,11 @@ abstract class SelectionPluginBase extends PluginBase implements SelectionInterf
* {@inheritdoc}
*/
public function setConfiguration(array $configuration) {
- // Resolve backward compatibility level configurations, if any.
- $this->resolveBackwardCompatibilityConfiguration($configuration);
-
// Merge in defaults.
$this->configuration = NestedArray::mergeDeep(
$this->defaultConfiguration(),
$configuration
);
-
- // Ensure a backward compatibility level configuration.
- $this->ensureBackwardCompatibilityConfiguration();
}
/**
@@ -94,75 +86,4 @@ abstract class SelectionPluginBase extends PluginBase implements SelectionInterf
*/
public function entityQueryAlter(SelectInterface $query) {}
- /**
- * Moves the backward compatibility level configurations in the right place.
- *
- * In order to keep backward compatibility, we copy all settings, except
- * 'target_type', 'handler' and 'entity' under 'handler_settings', following
- * the structure from the field config. If the plugin was instantiated using
- * the 'handler_settings' level, those values will be used. In case of
- * conflict, the root level settings will take precedence. The backward
- * compatibility aware configuration will have the next structure:
- * - target_type
- * - handler (will be removed in Drupal 9.0.x, it's the plugin id)
- * - entity
- * - setting_1
- * - setting_2
- * ...
- * - setting_N
- * - handler_settings: (will be removed in Drupal 9.0.x)
- * - setting_1
- * - setting_2
- * ...
- * - setting_N
- *
- * @param array $configuration
- * The configuration array to be altered.
- *
- * @internal
- *
- * @todo Remove this method call and its method in Drupal 9.
- *
- * @see https://www.drupal.org/project/drupal/issues/3069757
- * @see https://www.drupal.org/node/2870971
- */
- protected function resolveBackwardCompatibilityConfiguration(array &$configuration) {
- if (isset($this->defaultConfiguration()['handler_settings'])) {
- throw new \InvalidArgumentException("{$this->getPluginDefinition()['class']}::defaultConfiguration() should not contain a 'handler_settings' key. All settings should be placed in the root level.");
- }
-
- // Extract the BC level from the passed configuration, if any.
- if (array_key_exists('handler_settings', $configuration)) {
- if (!is_array($configuration['handler_settings'])) {
- throw new \InvalidArgumentException("The setting 'handler_settings' is reserved and cannot be used.");
- }
- @trigger_error("Providing settings under 'handler_settings' is deprecated in drupal:8.4.0 support for 'handler_settings' is removed from drupal:9.0.0. Move the settings in the root of the configuration array. See https://www.drupal.org/node/2870971", E_USER_DEPRECATED);
-
- // Settings passed in the root level take precedence over BC settings.
- $configuration += $configuration['handler_settings'];
- unset($configuration['handler_settings']);
- }
- }
-
- /**
- * Ensures a backward compatibility level configuration.
- *
- * @internal
- *
- * @todo Remove this method call and its method in Drupal 9.
- *
- * @see https://www.drupal.org/project/drupal/issues/3069757
- * @see https://www.drupal.org/node/2870971
- */
- protected function ensureBackwardCompatibilityConfiguration() {
- $keys = ['handler', 'target_type', 'entity', 'handler_settings'];
- // Synchronize back 'handler_settings'.
- foreach ($this->configuration as $key => $value) {
- // Filter out keys that belong strictly to the root level.
- if (!in_array($key, $keys, TRUE)) {
- $this->configuration['handler_settings'][$key] = $value;
- }
- }
- }
-
}
diff --git a/core/lib/Drupal/Core/Entity/EntityRepository.php b/core/lib/Drupal/Core/Entity/EntityRepository.php
index ab62bd9b096..895f12515e1 100644
--- a/core/lib/Drupal/Core/Entity/EntityRepository.php
+++ b/core/lib/Drupal/Core/Entity/EntityRepository.php
@@ -44,16 +44,10 @@ class EntityRepository implements EntityRepositoryInterface {
* @param \Drupal\Core\Plugin\Context\ContextRepositoryInterface $context_repository
* The context repository service.
*/
- public function __construct(EntityTypeManagerInterface $entity_type_manager, LanguageManagerInterface $language_manager, ContextRepositoryInterface $context_repository = NULL) {
+ public function __construct(EntityTypeManagerInterface $entity_type_manager, LanguageManagerInterface $language_manager, ContextRepositoryInterface $context_repository) {
$this->entityTypeManager = $entity_type_manager;
$this->languageManager = $language_manager;
- if (isset($context_repository)) {
- $this->contextRepository = $context_repository;
- }
- else {
- @trigger_error('The context.repository service must be passed to EntityRepository::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/2938929.', E_USER_DEPRECATED);
- $this->contextRepository = \Drupal::service('context.repository');
- }
+ $this->contextRepository = $context_repository;
}
/**
diff --git a/core/lib/Drupal/Core/Entity/EntityStorageBase.php b/core/lib/Drupal/Core/Entity/EntityStorageBase.php
index 25d2f603609..63b0f6f8042 100644
--- a/core/lib/Drupal/Core/Entity/EntityStorageBase.php
+++ b/core/lib/Drupal/Core/Entity/EntityStorageBase.php
@@ -88,18 +88,13 @@ abstract class EntityStorageBase extends EntityHandlerBase implements EntityStor
* @param \Drupal\Core\Cache\MemoryCache\MemoryCacheInterface|null $memory_cache
* The memory cache.
*/
- public function __construct(EntityTypeInterface $entity_type, MemoryCacheInterface $memory_cache = NULL) {
+ public function __construct(EntityTypeInterface $entity_type, MemoryCacheInterface $memory_cache) {
$this->entityTypeId = $entity_type->id();
$this->entityType = $entity_type;
$this->idKey = $this->entityType->getKey('id');
$this->uuidKey = $this->entityType->getKey('uuid');
$this->langcodeKey = $this->entityType->getKey('langcode');
$this->entityClass = $this->entityType->getClass();
-
- if (!isset($memory_cache)) {
- @trigger_error('The $memory_cache parameter was added in Drupal 8.6.x and will be required in 9.0.0. See https://www.drupal.org/node/2973262', E_USER_DEPRECATED);
- $memory_cache = \Drupal::service('entity.memory_cache');
- }
$this->memoryCache = $memory_cache;
$this->memoryCacheTag = 'entity.memory_cache:' . $this->entityTypeId;
}
diff --git a/core/lib/Drupal/Core/Entity/EntityType.php b/core/lib/Drupal/Core/Entity/EntityType.php
index 8155ff250cd..f24a4172e94 100644
--- a/core/lib/Drupal/Core/Entity/EntityType.php
+++ b/core/lib/Drupal/Core/Entity/EntityType.php
@@ -91,18 +91,6 @@ class EntityType extends PluginDefinition implements EntityTypeInterface {
*/
protected $links = [];
- /**
- * The name of a callback that returns the label of the entity.
- *
- * @var callable|null
- *
- * @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Override the
- * EntityInterface::label() method instead for dynamic labels.
- *
- * @see \Drupal\Core\Entity\EntityInterface::label()
- */
- protected $label_callback = NULL;
-
/**
* The name of the entity type which provides bundles.
*
@@ -662,31 +650,6 @@ class EntityType extends PluginDefinition implements EntityTypeInterface {
return $this;
}
- /**
- * {@inheritdoc}
- */
- public function getLabelCallback() {
- @trigger_error('EntityType::getLabelCallback() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Override the EntityInterface::label() method instead for dynamic labels. See https://www.drupal.org/node/3050794', E_USER_DEPRECATED);
- return $this->label_callback;
- }
-
- /**
- * {@inheritdoc}
- */
- public function setLabelCallback($callback) {
- @trigger_error('EntityType::setLabelCallback() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Override the EntityInterface::label() method instead for dynamic labels. See https://www.drupal.org/node/3050794', E_USER_DEPRECATED);
- $this->label_callback = $callback;
- return $this;
- }
-
- /**
- * {@inheritdoc}
- */
- public function hasLabelCallback() {
- @trigger_error('EntityType::hasabelCallback() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Override the EntityInterface::label() method instead for dynamic labels. See https://www.drupal.org/node/3050794', E_USER_DEPRECATED);
- return isset($this->label_callback);
- }
-
/**
* {@inheritdoc}
*/
@@ -773,14 +736,6 @@ class EntityType extends PluginDefinition implements EntityTypeInterface {
return $this->label;
}
- /**
- * {@inheritdoc}
- */
- public function getLowercaseLabel() {
- @trigger_error('EntityType::getLowercaseLabel() is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Instead, you should call getSingularLabel(). See https://www.drupal.org/node/3075567', E_USER_DEPRECATED);
- return mb_strtolower($this->getLabel());
- }
-
/**
* {@inheritdoc}
*/
diff --git a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php
index 89a10a1088f..f034b2b34c1 100644
--- a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php
@@ -475,62 +475,6 @@ interface EntityTypeInterface extends PluginDefinitionInterface {
*/
public function setLinkTemplate($key, $path);
- /**
- * Gets the callback for the label of the entity.
- *
- * The function takes an entity and returns the label of the entity. Use
- * language() on the entity to get information on the requested language. The
- * entity label is the main string associated with an entity; for example, the
- * title of a node or the subject of a comment. If there is an entity object
- * property that defines the label, use the 'label' element of the
- * 'entity_keys' return value component to provide this information. If more
- * complex logic is needed to determine the label of an entity, you can
- * instead specify a callback function here, which will be called to determine
- * the entity label.
- *
- * @return callable|null
- * The callback, or NULL if none exists.
- *
- * @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Override the
- * EntityInterface::label() method instead for dynamic labels.
- *
- * @see \Drupal\Core\Entity\EntityInterface::label()
- * @see \Drupal\Core\Entity\EntityTypeInterface::setLabelCallback()
- * @see \Drupal\Core\Entity\EntityTypeInterface::hasLabelCallback()
- */
- public function getLabelCallback();
-
- /**
- * Sets the label callback.
- *
- * @param callable $callback
- * A callable that returns the label of the entity.
- *
- * @return $this
- *
- * @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Override the
- * EntityInterface::label() method instead for dynamic labels.
- *
- * @see \Drupal\Core\Entity\EntityInterface::label()
- * @see \Drupal\Core\Entity\EntityTypeInterface::getLabelCallback()
- * @see \Drupal\Core\Entity\EntityTypeInterface::hasLabelCallback()
- */
- public function setLabelCallback($callback);
-
- /**
- * Indicates if a label callback exists.
- *
- * @return bool
- *
- * @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Override the
- * EntityInterface::label() method instead for dynamic labels.
- *
- * @see \Drupal\Core\Entity\EntityInterface::label()
- * @see \Drupal\Core\Entity\EntityTypeInterface::getLabelCallback()
- * @see \Drupal\Core\Entity\EntityTypeInterface::setLabelCallback()
- */
- public function hasLabelCallback();
-
/**
* Gets the name of the entity type which provides bundles.
*
@@ -656,20 +600,6 @@ interface EntityTypeInterface extends PluginDefinitionInterface {
*/
public function getLabel();
- /**
- * Gets the lowercase form of the human-readable entity type name.
- *
- * @return string
- * The lowercase form of the human-readable entity type name.
- *
- * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0.
- * Instead, you should call getSingularLabel().
- * See https://www.drupal.org/node/3075567
- *
- * @see \Drupal\Core\Entity\EntityTypeInterface::getLabel()
- */
- public function getLowercaseLabel();
-
/**
* Gets the uppercase plural form of the name of the entity type.
*
diff --git a/core/lib/Drupal/Core/Entity/EntityTypeRepository.php b/core/lib/Drupal/Core/Entity/EntityTypeRepository.php
index f63965a8b34..0bc900dbbcc 100644
--- a/core/lib/Drupal/Core/Entity/EntityTypeRepository.php
+++ b/core/lib/Drupal/Core/Entity/EntityTypeRepository.php
@@ -98,12 +98,4 @@ class EntityTypeRepository implements EntityTypeRepositoryInterface {
throw new NoCorrespondingEntityClassException($class_name);
}
- /**
- * {@inheritdoc}
- */
- public function clearCachedDefinitions() {
- @trigger_error(__METHOD__ . ' is deprecated in drupal:8.0.0 and is removed in drupal:9.0.0', E_USER_DEPRECATED);
- $this->classNameEntityTypeMap = [];
- }
-
}
diff --git a/core/lib/Drupal/Core/Entity/EntityTypeRepositoryInterface.php b/core/lib/Drupal/Core/Entity/EntityTypeRepositoryInterface.php
index 80b96e477a1..53af033e4dc 100644
--- a/core/lib/Drupal/Core/Entity/EntityTypeRepositoryInterface.php
+++ b/core/lib/Drupal/Core/Entity/EntityTypeRepositoryInterface.php
@@ -42,11 +42,4 @@ interface EntityTypeRepositoryInterface {
*/
public function getEntityTypeFromClass($class_name);
- /**
- * Clear the static cache.
- *
- * @deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.
- */
- public function clearCachedDefinitions();
-
}
diff --git a/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php b/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php
index 113f6307873..98c5a41a32c 100644
--- a/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php
+++ b/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php
@@ -64,7 +64,7 @@ class KeyValueEntityStorage extends EntityStorageBase {
* @param \Drupal\Core\Cache\MemoryCache\MemoryCacheInterface $memory_cache
* The memory cache.
*/
- public function __construct(EntityTypeInterface $entity_type, KeyValueStoreInterface $key_value_store, UuidInterface $uuid_service, LanguageManagerInterface $language_manager, MemoryCacheInterface $memory_cache = NULL) {
+ public function __construct(EntityTypeInterface $entity_type, KeyValueStoreInterface $key_value_store, UuidInterface $uuid_service, LanguageManagerInterface $language_manager, MemoryCacheInterface $memory_cache) {
parent::__construct($entity_type, $memory_cache);
$this->keyValueStore = $key_value_store;
$this->uuidService = $uuid_service;
diff --git a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionBase.php b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionBase.php
deleted file mode 100644
index 8deb1396cad..00000000000
--- a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionBase.php
+++ /dev/null
@@ -1,9 +0,0 @@
-entityFieldManager->getBaseFieldDefinitions($this->entityTypeId);
- }
-
/**
* Constructs a SqlContentEntityStorage object.
*
@@ -195,7 +177,7 @@ class SqlContentEntityStorage extends ContentEntityStorageBase implements SqlEnt
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
- public function __construct(EntityTypeInterface $entity_type, Connection $database, EntityFieldManagerInterface $entity_field_manager, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, MemoryCacheInterface $memory_cache = NULL, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, EntityTypeManagerInterface $entity_type_manager = NULL) {
+ public function __construct(EntityTypeInterface $entity_type, Connection $database, EntityFieldManagerInterface $entity_field_manager, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, MemoryCacheInterface $memory_cache, EntityTypeBundleInfoInterface $entity_type_bundle_info, EntityTypeManagerInterface $entity_type_manager) {
parent::__construct($entity_type, $entity_field_manager, $cache, $memory_cache, $entity_type_bundle_info);
$this->database = $database;
$this->languageManager = $language_manager;
@@ -624,17 +606,6 @@ class SqlContentEntityStorage extends ContentEntityStorageBase implements SqlEnt
}
}
- /**
- * {@inheritdoc}
- */
- protected function doLoadRevisionFieldItems($revision_id) {
- @trigger_error('"\Drupal\Core\Entity\ContentEntityStorageBase::doLoadRevisionFieldItems()" is deprecated in Drupal 8.5.x and will be removed before Drupal 9.0.0. "\Drupal\Core\Entity\ContentEntityStorageBase::doLoadMultipleRevisionsFieldItems()" should be implemented instead. See https://www.drupal.org/node/2924915.', E_USER_DEPRECATED);
-
- $revisions = $this->doLoadMultipleRevisionsFieldItems([$revision_id]);
-
- return !empty($revisions) ? reset($revisions) : NULL;
- }
-
/**
* {@inheritdoc}
*/
@@ -1803,22 +1774,4 @@ class SqlContentEntityStorage extends ContentEntityStorageBase implements SqlEnt
return $as_bool ? (bool) $count : (int) $count;
}
- /**
- * Determines whether the passed field has been already deleted.
- *
- * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition
- * The field storage definition.
- *
- * @return bool
- * Whether the field has been already deleted.
- *
- * @deprecated in drupal:8.5.0 and is removed from drupal:9.0.0. Use
- * \Drupal\Core\Field\FieldStorageDefinitionInterface::isDeleted() instead.
- *
- * @see https://www.drupal.org/node/2907785
- */
- protected function storageDefinitionIsDeleted(FieldStorageDefinitionInterface $storage_definition) {
- return $storage_definition->isDeleted();
- }
-
}
diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchemaConverter.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchemaConverter.php
deleted file mode 100644
index dcbc32c08f6..00000000000
--- a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchemaConverter.php
+++ /dev/null
@@ -1,146 +0,0 @@
-entityTypeId = $entity_type_id;
- $this->entityTypeManager = $entity_type_manager;
- $this->entityDefinitionUpdateManager = $entity_definition_update_manager;
- }
-
- /**
- * Converts an entity type with existing data to be revisionable.
- *
- * This process does the following tasks:
- * - creates the schema from scratch with the new revisionable entity type
- * definition (i.e. the current definition of the entity type from code)
- * using temporary table names;
- * - loads the initial entity data by using the last installed entity and
- * field storage definitions;
- * - saves the entity data to the temporary tables;
- * - at the end of the process:
- * - deletes the original tables and replaces them with the temporary ones
- * that hold the new (revisionable) entity data;
- * - updates the installed entity schema data;
- * - updates the entity type definition in order to trigger the
- * \Drupal\Core\Entity\EntityTypeEvents::UPDATE event;
- * - updates the field storage definitions in order to mark the
- * revisionable ones as such.
- *
- * In case of an error during the entity save process, the temporary tables
- * are deleted and the original entity type and field storage definitions are
- * restored.
- *
- * @param array $sandbox
- * The sandbox array from a hook_update_N() implementation.
- * @param string[] $fields_to_update
- * (optional) An array of field names that should be converted to be
- * revisionable. Note that the 'langcode' field, if present, is updated
- * automatically. Defaults to an empty array.
- *
- * @throws \Exception
- * Re-throws any exception raised during the update process.
- */
- public function convertToRevisionable(array &$sandbox, array $fields_to_update = []) {
- /** @var \Drupal\Core\Entity\ContentEntityTypeInterface $entity_type */
- $this->entityTypeManager->useCaches(FALSE);
- $entity_type = $this->entityTypeManager->getDefinition($this->entityTypeId);
-
- /** @var \Drupal\Core\Entity\EntityLastInstalledSchemaRepositoryInterface $last_installed_schema_repository */
- $last_installed_schema_repository = \Drupal::service('entity.last_installed_schema.repository');
- $field_storage_definitions = $last_installed_schema_repository->getLastInstalledFieldStorageDefinitions($this->entityTypeId);
-
- // Add the revision ID field.
- $field_name = $entity_type->getKey('revision');
- $field_storage_definitions[$entity_type->getKey('revision')] = BaseFieldDefinition::create('integer')
- ->setName($field_name)
- ->setTargetEntityTypeId($entity_type->id())
- ->setTargetBundle(NULL)
- ->setLabel(t('Revision ID'))
- ->setReadOnly(TRUE)
- ->setSetting('unsigned', TRUE);
-
- // Add the 'revision_default' field.
- $field_name = $entity_type->getRevisionMetadataKey('revision_default');
- $field_storage_definitions[$field_name] = BaseFieldDefinition::create('boolean')
- ->setName($field_name)
- ->setTargetEntityTypeId($entity_type->id())
- ->setTargetBundle(NULL)
- ->setLabel(t('Default revision'))
- ->setDescription(t('A flag indicating whether this was a default revision when it was saved.'))
- ->setStorageRequired(TRUE)
- ->setTranslatable(FALSE)
- ->setRevisionable(TRUE);
-
- // Add the 'revision_translation_affected' field if needed.
- if ($entity_type->isTranslatable()) {
- $field_name = $entity_type->getKey('revision_translation_affected');
- $field_storage_definitions[$field_name] = BaseFieldDefinition::create('boolean')
- ->setName($field_name)
- ->setTargetEntityTypeId($entity_type->id())
- ->setTargetBundle(NULL)
- ->setLabel(new TranslatableMarkup('Revision translation affected'))
- ->setDescription(new TranslatableMarkup('Indicates if the last edit of a translation belongs to current revision.'))
- ->setReadOnly(TRUE)
- ->setRevisionable(TRUE)
- ->setTranslatable(TRUE);
- }
-
- // Mark various fields as revisionable.
- $field_storage_definitions[$entity_type->getKey('langcode')]->setRevisionable(TRUE);
- foreach ($fields_to_update as $field_name) {
- $field_storage_definitions[$field_name]->setRevisionable(TRUE);
- }
-
- $this->entityDefinitionUpdateManager->updateFieldableEntityType($entity_type, $field_storage_definitions, $sandbox);
- }
-
-}
diff --git a/core/lib/Drupal/Core/Entity/Sql/TemporaryTableMapping.php b/core/lib/Drupal/Core/Entity/Sql/TemporaryTableMapping.php
deleted file mode 100644
index e73ed5e6058..00000000000
--- a/core/lib/Drupal/Core/Entity/Sql/TemporaryTableMapping.php
+++ /dev/null
@@ -1,51 +0,0 @@
- 48) {
- $short_table_name = substr($table_name, 0, 34);
- $table_hash = substr(hash('sha256', $table_name), 0, 10);
-
- $tmp_table_name = $prefix . $short_table_name . $table_hash;
- }
- return $tmp_table_name;
- }
-
-}
diff --git a/core/modules/comment/src/CommentStorage.php b/core/modules/comment/src/CommentStorage.php
index 7a4d69e6c14..2334e59220c 100644
--- a/core/modules/comment/src/CommentStorage.php
+++ b/core/modules/comment/src/CommentStorage.php
@@ -53,7 +53,7 @@ class CommentStorage extends SqlContentEntityStorage implements CommentStorageIn
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
- public function __construct(EntityTypeInterface $entity_info, Connection $database, EntityFieldManagerInterface $entity_field_manager, AccountInterface $current_user, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, MemoryCacheInterface $memory_cache, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, EntityTypeManagerInterface $entity_type_manager = NULL) {
+ public function __construct(EntityTypeInterface $entity_info, Connection $database, EntityFieldManagerInterface $entity_field_manager, AccountInterface $current_user, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, MemoryCacheInterface $memory_cache, EntityTypeBundleInfoInterface $entity_type_bundle_info, EntityTypeManagerInterface $entity_type_manager) {
parent::__construct($entity_info, $database, $entity_field_manager, $cache, $language_manager, $memory_cache, $entity_type_bundle_info, $entity_type_manager);
$this->currentUser = $current_user;
}
diff --git a/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php b/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php
index 3ac8f6823c9..b4e914feb6b 100644
--- a/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php
+++ b/core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php
@@ -313,9 +313,6 @@ class CommentLinkBuilderTest extends UnitTestCase {
$node->expects($this->any())
->method('toUrl')
->willReturn($url);
- $node->expects($this->any())
- ->method('url')
- ->willReturn(['route_name' => 'node.view']);
return $node;
}
diff --git a/core/modules/rest/src/Entity/RestResourceConfig.php b/core/modules/rest/src/Entity/RestResourceConfig.php
index c0a4e5c04c7..22dc6f4a7ec 100644
--- a/core/modules/rest/src/Entity/RestResourceConfig.php
+++ b/core/modules/rest/src/Entity/RestResourceConfig.php
@@ -22,7 +22,6 @@ use Drupal\rest\RestResourceConfigInterface;
* ),
* config_prefix = "resource",
* admin_permission = "administer rest resources",
- * label_callback = "getLabelFromPlugin",
* entity_keys = {
* "id" = "id"
* },
@@ -88,17 +87,6 @@ class RestResourceConfig extends ConfigEntityBase implements RestResourceConfigI
}
}
- /**
- * The label callback for this configuration entity.
- *
- * @return string The label.
- */
- protected function getLabelFromPlugin() {
- $plugin_definition = $this->getResourcePluginManager()
- ->getDefinition(['id' => $this->plugin_id]);
- return $plugin_definition['label'];
- }
-
/**
* Returns the resource plugin manager.
*
diff --git a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php
index 4f871f2a10c..bbb54156f5e 100644
--- a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php
+++ b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php
@@ -98,8 +98,8 @@ abstract class EntityResourceTestBase extends ResourceTestBase {
protected static $uniqueFieldNames = [];
/**
- * Optionally specify which field is the 'label' field. Some entities specify
- * a 'label_callback', but not a 'label' entity key. For example: User.
+ * Optionally specify which field is the 'label' field. Some entities do not
+ * specify a 'label' entity key. For example: User.
*
* @see ::getInvalidNormalizedEntityToCreate
*
diff --git a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestLabelCallback.php b/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestLabelCallback.php
deleted file mode 100644
index e3fd77e0af9..00000000000
--- a/core/modules/system/tests/modules/entity_test/src/Entity/EntityTestLabelCallback.php
+++ /dev/null
@@ -1,24 +0,0 @@
-storage->save();
}
- /**
- * {@inheritdoc}
- */
- public function urlInfo($rel = 'edit-form', array $options = []) {
- return $this->storage->toUrl($rel, $options);
- }
-
/**
* {@inheritdoc}
*/
@@ -1005,13 +998,6 @@ class ViewUI implements ViewEntityInterface {
return $this->storage->toUrl($rel, $options);
}
- /**
- * {@inheritdoc}
- */
- public function link($text = NULL, $rel = 'edit-form', array $options = []) {
- return $this->storage->link($text, $rel, $options);
- }
-
/**
* {@inheritdoc}
*/
@@ -1169,13 +1155,6 @@ class ViewUI implements ViewEntityInterface {
return $this->storage->referencedEntities();
}
- /**
- * {@inheritdoc}
- */
- public function url($rel = 'edit-form', $options = []) {
- return $this->storage->url($rel, $options);
- }
-
/**
* {@inheritdoc}
*/
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php
index 28766fd8298..8bfc6d0055d 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php
@@ -274,8 +274,8 @@ class FieldSqlStorageTest extends EntityKernelTestBase {
*/
public function testLongNames() {
// Use one of the longest entity_type names in core.
- $entity_type = $bundle = 'entity_test_label_callback';
- $this->installEntitySchema('entity_test_label_callback');
+ $entity_type = $bundle = 'entity_test_multivalue_basefield';
+ $this->installEntitySchema('entity_test_multivalue_basefield');
$storage = $this->container->get('entity_type.manager')->getStorage($entity_type);
// Create two fields and generate random values.
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/LegacyEntityDisplayBaseTest.php b/core/tests/Drupal/KernelTests/Core/Entity/LegacyEntityDisplayBaseTest.php
deleted file mode 100644
index f7bec4976eb..00000000000
--- a/core/tests/Drupal/KernelTests/Core/Entity/LegacyEntityDisplayBaseTest.php
+++ /dev/null
@@ -1,103 +0,0 @@
-installEntitySchema('comment');
- $this->installEntitySchema('entity_test');
- $this->installSchema('user', ['users_data']);
- }
-
- /**
- * Tests legacy handling of 'type' => 'hidden'.
- *
- * @group legacy
- *
- * @expectedDeprecation Support for using 'type' => 'hidden' in a component is deprecated in drupal:8.3.0 and is removed from drupal:9.0.0. Use 'region' => 'hidden' instead. See https://www.drupal.org/node/2801513
- */
- public function testLegacyPreSave() {
- $entity_display = EntityViewDisplay::create([
- 'targetEntityType' => 'entity_test',
- 'bundle' => 'entity_test',
- 'mode' => 'default',
- 'status' => TRUE,
- 'content' => [
- 'foo' => ['type' => 'visible'],
- 'bar' => ['type' => 'hidden'],
- 'name' => ['type' => 'hidden', 'region' => 'content'],
- ],
- ]);
-
- // Ensure that no region is set on the component.
- $this->assertArrayNotHasKey('region', $entity_display->getComponent('foo'));
- $this->assertArrayNotHasKey('region', $entity_display->getComponent('bar'));
-
- // Ensure that a region is set on the component after saving.
- $entity_display->save();
-
- // The component with a visible type has been assigned a region.
- $component = $entity_display->getComponent('foo');
- $this->assertArrayHasKey('region', $component);
- $this->assertSame('content', $component['region']);
-
- // The component with a hidden type has been removed.
- $this->assertNull($entity_display->getComponent('bar'));
-
- // The component with a valid region and hidden type is unchanged.
- $component = $entity_display->getComponent('name');
- $this->assertArrayHasKey('region', $component);
- $this->assertSame('content', $component['region']);
- }
-
- /**
- * Tests the deprecated ::handleHiddenType() method.
- *
- * @expectedDeprecation Drupal\Core\Entity\EntityDisplayBase::handleHiddenType is deprecated in drupal:8.3.0 and is removed from drupal:9.0.0. No replacement is provided. See https://www.drupal.org/node/2801513
- */
- public function testHandleHiddenType() {
- $entity_display = EntityViewDisplay::create([
- 'targetEntityType' => 'entity_test',
- 'bundle' => 'entity_test',
- 'mode' => 'default',
- 'status' => TRUE,
- 'content' => [
- 'foo' => ['type' => 'visible'],
- 'bar' => ['type' => 'hidden'],
- 'name' => ['type' => 'hidden', 'region' => 'content'],
- ],
- ]);
- $method = new \ReflectionMethod($entity_display, 'handleHiddenType');
- $method->setAccessible(TRUE);
- $this->assertSame(['type' => 'hidden'], $entity_display->getComponent('bar'));
- $method->invoke($entity_display, 'bar', ['type' => 'hidden']);
- $this->assertNull($entity_display->getComponent('bar'));
- }
-
-}
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/SqlContentEntityStorageSchemaConverterTest.php b/core/tests/Drupal/KernelTests/Core/Entity/SqlContentEntityStorageSchemaConverterTest.php
deleted file mode 100644
index aff91515aae..00000000000
--- a/core/tests/Drupal/KernelTests/Core/Entity/SqlContentEntityStorageSchemaConverterTest.php
+++ /dev/null
@@ -1,52 +0,0 @@
-schema();
- $this->assertFalse($schema->tableExists('entity_test_new'), 'Schema for the "entity_test_new" entity type does not exist.');
-
- // Check that the "entity_test_new" schema has been created.
- $this->enableNewEntityType();
- $this->assertTrue($schema->tableExists('entity_test_new'), 'Schema for the "entity_test_new" entity type has been created.');
-
- // Update the entity type definition to revisionable.
- $entity_type = clone \Drupal::entityTypeManager()->getDefinition('entity_test_new');
- $keys = $entity_type->getKeys();
- $keys['revision'] = 'revision_id';
- $entity_type->set('entity_keys', $keys);
- $entity_type->set('revision_table', 'entity_test_new_revision');
- $this->state->set('entity_test_new.entity_type', $entity_type);
- \Drupal::entityTypeManager()->clearCachedDefinitions();
-
- $revisionable_schema_converter = new SqlContentEntityStorageSchemaConverter(
- 'entity_test_new',
- \Drupal::entityTypeManager(),
- \Drupal::entityDefinitionUpdateManager()
- );
- $sandbox = [];
- $revisionable_schema_converter->convertToRevisionable($sandbox, []);
- $this->assertTrue($schema->tableExists('entity_test_new_revision'), 'Schema for the "entity_test_new" entity type has been created.');
- }
-
-}
diff --git a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
index 63d83117dc8..d02dc5aa368 100644
--- a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
@@ -472,31 +472,6 @@ class ContentEntityBaseUnitTest extends UnitTestCase {
$this->assertEquals(AccessResult::allowed(), $this->entity->access('create', NULL, TRUE));
}
- /**
- * @covers ::label
- *
- * @group legacy
- */
- public function testLabel() {
-
- $this->addExpectedDeprecationMessage('Entity type ' . $this->entityTypeId . ' defines a label callback. Support for that is deprecated in drupal:8.0.0 and will be removed in drupal:9.0.0. Override the EntityInterface::label() method instead. See https://www.drupal.org/node/3050794');
-
- // Make a mock with one method that we use as the entity's label callback.
- // We check that it is called, and that the entity's label is the callback's
- // return value.
- $callback_label = $this->randomMachineName();
- $callback_container = $this->createMock(get_class());
- $callback_container->expects($this->once())
- ->method(__FUNCTION__)
- ->will($this->returnValue($callback_label));
- $this->entityType->expects($this->once())
- ->method('get')
- ->with('label_callback')
- ->will($this->returnValue([$callback_container, __FUNCTION__]));
-
- $this->assertSame($callback_label, $this->entity->label());
- }
-
/**
* Data provider for testGet().
*
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityDefinitionUpdateManagerTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityDefinitionUpdateManagerTest.php
deleted file mode 100644
index af1f5a2057d..00000000000
--- a/core/tests/Drupal/Tests/Core/Entity/EntityDefinitionUpdateManagerTest.php
+++ /dev/null
@@ -1,35 +0,0 @@
-prophesize(EntityTypeManagerInterface::class)->reveal();
- $entity_last_installed_schema_repository = $this->prophesize(EntityLastInstalledSchemaRepositoryInterface::class)->reveal();
- $entity_field_manager = $this->prophesize(EntityFieldManagerInterface::class)->reveal();
- $entity_type_listener = $this->prophesize(EntityTypeListenerInterface::class)->reveal();
- $field_storage_definition_listener = $this->prophesize(FieldStorageDefinitionListenerInterface::class)->reveal();
-
- $entity_definition_update_manager = new EntityDefinitionUpdateManager($entity_type_manager, $entity_last_installed_schema_repository, $entity_field_manager, $entity_type_listener, $field_storage_definition_listener);
-
- $this->assertNull($entity_definition_update_manager->applyUpdates());
- }
-
-}
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php
index 54a30c79b39..ca6948c1685 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityLinkTest.php
@@ -9,7 +9,7 @@ use Drupal\Core\Link;
use Drupal\Tests\UnitTestCase;
/**
- * @coversDefaultClass \Drupal\Core\Entity\Entity
+ * @coversDefaultClass \Drupal\Core\Entity\EntityBase
* @group Entity
*/
class EntityLinkTest extends UnitTestCase {
@@ -52,88 +52,12 @@ class EntityLinkTest extends UnitTestCase {
\Drupal::setContainer($container);
}
- /**
- * Tests for the Entity::link() method
- *
- * @covers ::link
- *
- * @dataProvider providerTestLink
- *
- * @group legacy
- *
- * Note this is only a legacy test because it triggers a call to
- * \Drupal\Core\Entity\EntityTypeInterface::getLabelCallback() which is mocked
- * and triggers a deprecation error. Remove when ::getLabelCallback() is
- * removed.
- */
- public function testLink($entity_label, $link_text, $expected_text, $link_rel = 'canonical', array $link_options = []) {
- $language = new Language(['id' => 'es']);
- $link_options += ['language' => $language];
- $this->languageManager->expects($this->any())
- ->method('getLanguage')
- ->with('es')
- ->willReturn($language);
-
- $route_name_map = [
- 'canonical' => 'entity.test_entity_type.canonical',
- 'edit-form' => 'entity.test_entity_type.edit_form',
- ];
- $route_name = $route_name_map[$link_rel];
- $entity_id = 'test_entity_id';
- $entity_type_id = 'test_entity_type';
- $expected = '' . $expected_text . '';
-
- $entity_type = $this->createMock('Drupal\Core\Entity\EntityTypeInterface');
- $entity_type->expects($this->once())
- ->method('getLinkTemplates')
- ->willReturn($route_name_map);
- $entity_type->expects($this->any())
- ->method('getKey')
- ->willReturnMap([
- ['label', 'label'],
- ['langcode', 'langcode'],
- ]);
-
- $this->entityTypeManager
- ->expects($this->any())
- ->method('getDefinition')
- ->with($entity_type_id)
- ->will($this->returnValue($entity_type));
-
- /** @var \Drupal\Core\Entity\Entity $entity */
- $entity = $this->getMockForAbstractClass('Drupal\Core\Entity\EntityBase', [
- ['id' => $entity_id, 'label' => $entity_label, 'langcode' => 'es'],
- $entity_type_id,
- ]);
-
- $expected_link = Link::createFromRoute(
- $expected_text,
- $route_name,
- [$entity_type_id => $entity_id],
- ['entity_type' => $entity_type_id, 'entity' => $entity] + $link_options
- )->setLinkGenerator($this->linkGenerator);
-
- $this->linkGenerator->expects($this->once())
- ->method('generateFromLink')
- ->with($this->equalTo($expected_link))
- ->willReturn($expected);
-
- $this->assertSame($expected, $entity->toLink($link_text, $link_rel, $link_options)->toString());
- }
-
/**
* Tests for the Entity::toLink() method
*
* @covers ::toLink
*
* @dataProvider providerTestLink
- *
- * @group legacy
- *
- * Note this is only a legacy test because it triggers a call to
- * \Drupal\Core\Entity\EntityTypeInterface::getLabelCallback() which is mocked
- * and triggers a deprecation error. Remove when ::getLabelCallback() is
- * removed.
*/
public function testToLink($entity_label, $link_text, $expected_text, $link_rel = 'canonical', array $link_options = []) {
$language = new Language(['id' => 'es']);
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php
index 6d5812ac2e5..d2152247d40 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php
@@ -520,47 +520,4 @@ class EntityTypeTest extends UnitTestCase {
$this->assertEquals('example_entity_type', $entity_type->id());
}
- /**
- * @covers ::getLabelCallback
- *
- * @group legacy
- *
- * @deprecatedMessage EntityType::getLabelCallback() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Override the EntityInterface::label() method instead for dynamic labels. See https://www.drupal.org/node/3050794
- */
- public function testGetLabelCallack() {
- $entity_type = $this->setUpEntityType(['label_callback' => 'label_function']);
- $this->assertSame('label_function', $entity_type->getLabelCallback());
-
- $entity_type = $this->setUpEntityType([]);
- $this->assertNull($entity_type->getLabelCallback());
- }
-
- /**
- * @covers ::setLabelCallback
- *
- * @group legacy
- *
- * @deprecatedMessage EntityType::setLabelCallback() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Override the EntityInterface::label() method instead for dynamic labels. See https://www.drupal.org/node/3050794
- */
- public function testSetLabelCallack() {
- $entity_type = $this->setUpEntityType([]);
- $entity_type->setLabelCallback('label_function');
- $this->assertSame('label_function', $entity_type->get('label_callback'));
- }
-
- /**
- * @covers ::hasLabelCallback
- *
- * @group legacy
- *
- * @deprecatedMessage EntityType::hasLabelCallback() is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Override the EntityInterface::label() method instead for dynamic labels. See https://www.drupal.org/node/3050794
- */
- public function testHasLabelCallack() {
- $entity_type = $this->setUpEntityType(['label_callback' => 'label_function']);
- $this->assertTrue($entity_type->hasLabelCallback());
-
- $entity_type = $this->setUpEntityType([]);
- $this->assertFalse($entity_type->hasLabelCallback());
- }
-
}
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php
index eea49f67501..d81bbdac725 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php
@@ -14,7 +14,7 @@ use Drupal\Tests\Traits\ExpectDeprecationTrait;
use Drupal\Tests\UnitTestCase;
/**
- * @coversDefaultClass \Drupal\Core\Entity\Entity
+ * @coversDefaultClass \Drupal\Core\Entity\EntityBase
* @group Entity
* @group Access
*/
@@ -169,33 +169,17 @@ class EntityUnitTest extends UnitTestCase {
/**
* @covers ::label
- * @group legacy
*/
public function testLabel() {
-
- $this->addExpectedDeprecationMessage('Entity type ' . $this->entityTypeId . ' defines a label callback. Support for that is deprecated in drupal:8.0.0 and will be removed in drupal:9.0.0. Override the EntityInterface::label() method instead. See https://www.drupal.org/node/3050794');
-
- // Make a mock with one method that we use as the entity's uri_callback. We
- // check that it is called, and that the entity's label is the callback's
- // return value.
- $callback_label = $this->randomMachineName();
$property_label = $this->randomMachineName();
- $callback_container = $this->createMock(get_class());
- $callback_container->expects($this->once())
- ->method(__FUNCTION__)
- ->will($this->returnValue($callback_label));
- $this->entityType->expects($this->at(0))
- ->method('get')
- ->with('label_callback')
- ->will($this->returnValue([$callback_container, __FUNCTION__]));
- $this->entityType->expects($this->at(2))
+ $this->entityType->expects($this->atLeastOnce())
->method('getKey')
->with('label')
->will($this->returnValue('label'));
// Set a dummy property on the entity under test to test that the label can
// be returned form a property if there is no callback.
- $this->entityTypeManager->expects($this->at(1))
+ $this->entityTypeManager->expects($this->atLeastOnce())
->method('getDefinition')
->with($this->entityTypeId)
->will($this->returnValue([
@@ -205,7 +189,6 @@ class EntityUnitTest extends UnitTestCase {
]));
$this->entity->label = $property_label;
- $this->assertSame($callback_label, $this->entity->label());
$this->assertSame($property_label, $this->entity->label());
}
diff --git a/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php
index ac9090bf409..8b49127b0f5 100644
--- a/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php
@@ -10,16 +10,15 @@ use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\Exception\UndefinedLinkTemplateException;
use Drupal\Core\Entity\RevisionableInterface;
use Drupal\Core\GeneratedUrl;
-use Drupal\Core\Link;
use Drupal\Core\Routing\UrlGeneratorInterface;
use Drupal\Core\Url;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\Routing\Exception\MissingMandatoryParametersException;
/**
- * Tests URL handling of the \Drupal\Core\Entity\Entity class.
+ * Tests URL handling of the \Drupal\Core\Entity\EntityBase class.
*
- * @coversDefaultClass \Drupal\Core\Entity\Entity
+ * @coversDefaultClass \Drupal\Core\Entity\EntityBase
*
* @group Entity
*/
@@ -378,164 +377,6 @@ class EntityUrlTest extends UnitTestCase {
return $test_cases;
}
- /**
- * Tests the urlInfo() method.
- *
- * @param string $rel
- * The link relation to test.
- * @param array $options
- * An array of URL options to test with.
- *
- * @covers ::urlInfo
- *
- * @dataProvider providerTestUrlInfo
- *
- * @group legacy
- * @expectedDeprecation EntityInterface::urlInfo() is deprecated in Drupal 8.0.0 and will be removed in Drupal 9.0.0. EntityInterface::toUrl() instead. See https://www.drupal.org/node/2614344
- */
- public function testUrlInfo($rel, $options) {
- $entity = $this->getEntity(EntityBase::class, [], ['toUrl']);
- $entity->expects($this->once())
- ->method('toUrl')
- ->with($rel, $options);
-
- $entity->urlInfo($rel, $options);
- }
-
- /**
- * Tests the link() method.
- *
- * @covers ::urlInfo
- *
- * @group legacy
- * @expectedDeprecation EntityInterface::link() is deprecated in Drupal 8.0.0 and will be removed in Drupal 9.0.0. Use EntityInterface::toLink()->toString() instead. Note, the default relationship for configuration entities changes from 'edit-form' to 'canonical'. See https://www.drupal.org/node/2614344
- */
- public function testLink() {
-
- $link = $this->createMock(Link::class);
- $link->expects($this->once())
- ->method('toString')
- ->willReturn('The link');
-
- $entity = $this->getEntity(EntityBase::class, [], ['toLink']);
- $entity->expects($this->once())
- ->method('toLink')
- ->with(NULL, 'canonical')
- ->willReturn($link);
-
- $this->assertEquals('The link', $entity->link());
- }
-
- /**
- * Provides data for testUrlInfo().
- *
- * @return array
- * An array of test cases for testUrlInfo().
- */
- public function providerTestUrlInfo() {
- $test_cases = [];
-
- $test_cases['default'] = ['canonical', []];
- $test_cases['with_option'] = ['canonical', ['absolute' => TRUE]];
- $test_cases['revision'] = ['revision', []];
-
- return $test_cases;
- }
-
- /**
- * Tests the url() method without an entity ID.
- *
- * @param string $rel
- * The link relation to test.
- *
- * @covers ::url
- * @covers ::hasLinkTemplate
- * @covers ::linkTemplates
- *
- * @dataProvider providerTestUrl
- *
- * @group legacy
- * @expectedDeprecation EntityInterface::url() is deprecated in Drupal 8.0.0 and will be removed in Drupal 9.0.0. EntityInterface::toUrl() instead. Note, a \Drupal\Core\Url object is returned. See https://www.drupal.org/node/2614344
- */
- public function testUrlEmpty($rel) {
- $entity = $this->getEntity(EntityBase::class, []);
- $this->assertEquals('', $entity->url($rel));
- }
-
- /**
- * Provides data for testUrlEmpty().
- *
- * @return array
- * An array of test cases for testUrlEmpty().
- */
- public function providerTestUrlEmpty() {
- $test_cases = [];
-
- $test_cases['default'] = ['canonical', []];
- $test_cases['revision'] = ['revision', []];
-
- return $test_cases;
- }
-
- /**
- * Tests the url() method.
- *
- * @param string $rel
- * The link relation to test.
- * @param array $options
- * An array of URL options to call url() with.
- * @param array $default_options
- * An array of URL options that toUrl() should generate.
- * @param array $expected_options
- * An array of combined URL options that should be set on the final URL.
- *
- * @covers ::url
- * @covers ::hasLinkTemplate
- * @covers ::linkTemplates
- *
- * @dataProvider providerTestUrl
- *
- * @group legacy
- * @expectedDeprecation EntityInterface::url() is deprecated in Drupal 8.0.0 and will be removed in Drupal 9.0.0. EntityInterface::toUrl() instead. Note, a \Drupal\Core\Url object is returned. See https://www.drupal.org/node/2614344
- */
- public function testUrl($rel, $options, $default_options, $expected_options) {
- $entity = $this->getEntity(EntityBase::class, ['id' => $this->entityId], ['toUrl']);
- $this->registerLinkTemplate($rel);
-
- $uri = $this->prophesize(Url::class);
- $uri->getOptions()->willReturn($default_options);
- $uri->setOptions($expected_options)->shouldBeCalled();
-
- $url_string = "/test-entity/{$this->entityId}/$rel";
- $uri->toString()->willReturn($url_string);
-
- $entity->expects($this->once())
- ->method('toUrl')
- ->with($rel)
- ->willReturn($uri->reveal());
-
- $this->assertEquals($url_string, $entity->url($rel, $options));
- }
-
- /**
- * Provides data for testUrl().
- *
- * @return array
- * An array of test cases for testUrl().
- */
- public function providerTestUrl() {
- $test_cases = [];
-
- $test_cases['default'] = ['canonical', [], [], []];
- $test_cases['revision'] = ['revision', [], [], []];
- $test_cases['option'] = ['canonical', ['absolute' => TRUE], [], ['absolute' => TRUE]];
- $test_cases['default_option'] = ['canonical', [], ['absolute' => TRUE], ['absolute' => TRUE]];
- $test_cases['option_merge'] = ['canonical', ['absolute' => TRUE], ['entity_type' => $this->entityTypeId], ['absolute' => TRUE, 'entity_type' => $this->entityTypeId]];
- $test_cases['option_override'] = ['canonical', ['absolute' => TRUE], ['absolute' => FALSE], ['absolute' => TRUE]];
-
- return $test_cases;
- }
-
/**
* Tests the uriRelationships() method.
*
diff --git a/core/tests/Drupal/Tests/Core/Entity/LegacyContentEntityStorageBaseTest.php b/core/tests/Drupal/Tests/Core/Entity/LegacyContentEntityStorageBaseTest.php
deleted file mode 100644
index 9ad6e831f11..00000000000
--- a/core/tests/Drupal/Tests/Core/Entity/LegacyContentEntityStorageBaseTest.php
+++ /dev/null
@@ -1,51 +0,0 @@
-doLoadMultipleRevisionsFieldItems([]);
- $this->assertSame([], $items);
- }
-
-}
-
-/**
- * Test class for ContentEntityStorageBaseTest.
- */
-class TestContentEntityStorageBase extends ContentEntityNullStorage {
-
- /**
- * Constructs a TestContentEntityStorageBase object.
- */
- public function __construct() {
- }
-
- /**
- * {@inheritdoc}
- */
- public function doLoadMultipleRevisionsFieldItems($revision_ids) {
- return parent::doLoadMultipleRevisionsFieldItems($revision_ids);
- }
-
-}
diff --git a/core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php b/core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php
index 7af9ec3cb90..6edc2498cdb 100644
--- a/core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php
@@ -4,7 +4,6 @@ namespace Drupal\Tests\Core\Entity\Sql;
use Drupal\Core\Entity\Sql\DefaultTableMapping;
use Drupal\Core\Entity\Sql\SqlContentEntityStorageException;
-use Drupal\Core\Entity\Sql\TemporaryTableMapping;
use Drupal\Tests\UnitTestCase;
/**
@@ -572,17 +571,6 @@ class DefaultTableMappingTest extends UnitTestCase {
return $data;
}
- /**
- * @coversDefaultClass \Drupal\Core\Entity\Sql\TemporaryTableMapping
- *
- * @expectedDeprecation Drupal\Core\Entity\Sql\TemporaryTableMapping is deprecated in Drupal 8.7.x and will be removed before Drupal 9.0.0. Use the default table mapping with a prefix instead.
- * @group legacy
- */
- public function testTemporaryTableMapping() {
- $table_mapping = new TemporaryTableMapping($this->entityType, [], '');
- $this->assertTrue($table_mapping instanceof DefaultTableMapping);
- }
-
/**
* Sets up a field storage definition for the test.
*
diff --git a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php
index e76a3b30a70..ecb3fd046e0 100644
--- a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php
@@ -1450,18 +1450,6 @@ class SqlContentEntityStorageTest extends UnitTestCase {
}
- /**
- * @covers ::getFieldStorageDefinitions
- *
- * @expectedDeprecation SqlContentEntityStorage::getFieldStorageDefinitions() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use \Drupal\Core\Entity\EntityFieldManagerInterface::getActiveFieldStorageDefinitions() instead. See https://www.drupal.org/node/3040966.
- *
- * @group legacy
- */
- public function testGetFieldStorageDefinitions() {
- $this->setUpEntityStorage();
- $this->entityStorage->getFieldStorageDefinitions();
- }
-
/**
* Sets up the module handler with no implementations.
*/
diff --git a/core/tests/Drupal/Tests/Core/EntityReferenceSelection/EntityReferenceSelectionUnitTest.php b/core/tests/Drupal/Tests/Core/EntityReferenceSelection/EntityReferenceSelectionUnitTest.php
deleted file mode 100644
index c742f129ef0..00000000000
--- a/core/tests/Drupal/Tests/Core/EntityReferenceSelection/EntityReferenceSelectionUnitTest.php
+++ /dev/null
@@ -1,237 +0,0 @@
-expectException(\InvalidArgumentException::class);
- $this->expectExceptionMessage("TestSelectionWithInvalidDefaultConfiguration::defaultConfiguration() should not contain a 'handler_settings' key. All settings should be placed in the root level.");
- new TestSelectionWithInvalidDefaultConfiguration(
- [],
- 'test_selector',
- ['class' => 'TestSelectionWithInvalidDefaultConfiguration']
- );
- }
-
- /**
- * Tests the selection handler with malformed 'handler_settings' value.
- *
- * @covers ::setConfiguration
- * @covers ::resolveBackwardCompatibilityConfiguration
- */
- public function testMalformedHandlerSettingsValue() {
- $this->expectException(\InvalidArgumentException::class);
- $this->expectExceptionMessage("The setting 'handler_settings' is reserved and cannot be used.");
- new TestSelection(
- // The deprecated 'handler_setting' should be an array.
- ['handler_settings' => FALSE],
- 'test_selector',
- ['class' => 'TestSelectionWithInvalidDefaultConfiguration']
- );
- }
-
- /**
- * Provides test data for ::testSetConfiguration()
- *
- * @return array
- *
- * @see \Drupal\Tests\Core\EntityReferenceSelection\testSetConfiguration
- */
- public function providerTestSetConfiguration() {
- return [
- [
- [
- 'setting1' => 'foo',
- 'setting2' => [
- 'bar' => 'bar value',
- 'baz' => 'baz value',
- ],
- ],
- ],
- [
- [
- 'handler_settings' => [
- 'setting1' => 'foo',
- 'setting2' => [
- 'bar' => 'bar value',
- 'baz' => 'baz value',
- ],
- ],
- ],
- ],
- [
- [
- 'setting1' => 'foo',
- 'handler_settings' => [
- 'setting2' => [
- 'bar' => 'bar value',
- 'baz' => 'baz value',
- ],
- ],
- ],
- ],
- [
- [
- 'setting1' => 'foo',
- 'setting2' => [
- 'bar' => 'bar value',
- 'baz' => 'baz value',
- ],
- 'handler_settings' => [
- // Same setting from root level takes precedence.
- 'setting2' => 'this will be overwritten',
- ],
- ],
- ],
- ];
- }
-
- /**
- * Tests selection handler plugin configuration set.
- *
- * @dataProvider providerTestSetConfiguration
- * @covers ::setConfiguration
- * @covers ::resolveBackwardCompatibilityConfiguration
- * @covers ::ensureBackwardCompatibilityConfiguration
- *
- * @param array $options
- * The configuration passed to the plugin.
- */
- public function testSetConfiguration($options) {
- $selection = new TestSelection($options, 'test_selector', []);
-
- $expected = [
- 'target_type' => NULL,
- 'handler' => 'test_selector',
- 'entity' => NULL,
- 'setting1' => 'foo',
- 'setting2' => [
- 'qux' => 'qux value',
- 'bar' => 'bar value',
- 'baz' => 'baz value',
- ],
- 'setting3' => 'foobar',
- 'handler_settings' => [
- 'setting1' => 'foo',
- 'setting2' => [
- 'qux' => 'qux value',
- 'bar' => 'bar value',
- 'baz' => 'baz value',
- ],
- 'setting3' => 'foobar',
- ],
- ];
-
- $this->assertArrayEquals($expected, $selection->getConfiguration());
- }
-
- /**
- * Tests the selection handler plugin BC structure.
- *
- * @covers ::setConfiguration
- * @covers ::resolveBackwardCompatibilityConfiguration
- * @covers ::ensureBackwardCompatibilityConfiguration
- */
- public function testSetConfigurationBcLevel() {
- $config = [
- 'target_type' => 'some_entity_type_id',
- 'handler' => 'test_selector',
- 'setting1' => 'foo',
- ];
- $selection = new TestSelection($config, 'test_selector', []);
-
- $expected = [
- 'target_type' => 'some_entity_type_id',
- 'handler' => 'test_selector',
- 'entity' => NULL,
- 'setting1' => 'foo',
- 'setting2' => ['qux' => 'qux value'],
- 'setting3' => 'foobar',
- 'handler_settings' => [
- 'setting1' => 'foo',
- 'setting2' => ['qux' => 'qux value'],
- 'setting3' => 'foobar',
- ],
- ];
-
- $this->assertArrayEquals($expected, $selection->getConfiguration());
-
- // Read the stored values and override a setting.
- $config = $selection->getConfiguration();
- $config['setting1'] = 'bar';
- $selection->setConfiguration($config);
- $expected['setting1'] = 'bar';
- $expected['handler_settings']['setting1'] = 'bar';
-
- $this->assertArrayEquals($expected, $selection->getConfiguration());
- }
-
- /**
- * Tests deprecation error triggering.
- *
- * @covers ::setConfiguration
- * @covers ::resolveBackwardCompatibilityConfiguration
- * @expectedDeprecation Providing settings under 'handler_settings' is deprecated in drupal:8.4.0 support for 'handler_settings' is removed from drupal:9.0.0. Move the settings in the root of the configuration array. See https://www.drupal.org/node/2870971
- */
- public function testDeprecationErrorTriggering() {
- // Configuration with BC level.
- $config = ['handler_settings' => ['setting1' => TRUE]];
- new TestSelection($config, 'test_selector', []);
- // Ensure at least one assertion.
- $this->assertTrue(TRUE);
- }
-
-}
-
-/**
- * Provides a testing plugin.
- */
-class TestSelection extends SelectionPluginBase {
-
- public function defaultConfiguration() {
- return [
- 'setting2' => [
- 'qux' => 'qux value',
- ],
- 'setting3' => 'foobar',
- ] + parent::defaultConfiguration();
- }
-
- public function getReferenceableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0) {}
-
- public function validateReferenceableEntities(array $ids) {}
-
- public function countReferenceableEntities($match = NULL, $match_operator = 'CONTAINS') {}
-
-}
-
-/**
- * Provides a testing plugin with invalid default configuration.
- */
-class TestSelectionWithInvalidDefaultConfiguration extends TestSelection {
-
- public function defaultConfiguration() {
- return [
- 'handler_settings' => ['foo' => 'bar'],
- ];
- }
-
-}