Problem/Motivation

On the quest to kill entity manager, berdir and I discussed this as a good choke point to kill a large number of usages in tests. We can use the deprecated service property trait to trigger an error on entityManager usage here and remove about 100 usages in tests from core.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mikelutz created an issue. See original summary.

mikelutz’s picture

Pretty straightforward, I hope...

Berdir’s picture

Status: Needs review » Reviewed & tested by the community
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php
@@ -169,7 +169,7 @@ protected function uninstallModule($module) {
    */
   protected function refreshServices() {
     $this->container = \Drupal::getContainer();
-    $this->entityManager = $this->container->get('entity.manager');
+
     $this->entityTypeManager = $this->container->get('entity_type.manager');
     $this->state = $this->container->get('state');
   }

Thought if this a problem, but the new DeprecatedServicePropertyTrait doesn't set it, so every call will go directly to \Drupal::service(), which means there's no problem with stale objects.

This a simple search & replace that makes sense as a standalone issue.

mikelutz’s picture

That was my conclusion on the refreshServices call as well.

larowlan’s picture

Status: Reviewed & tested by the community » Fixed

👊Committed b9f30c9 and pushed to 8.8.x. Thanks!

  • larowlan committed b9f30c9 on 8.8.x
    Issue #3052272 by mikelutz: Remove entityManager use in...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.