Issue #3643939: EntityTrait::reloadEntity() doesn't work with a config entity

Closes https://www.drupal.org/project/drupal/issues/3643939

Problem/Motivation

Drupal\Tests\EntityTrait::reloadEntity() does not work for config entities because ConfigFactory keeps its own static cache separate from entity storage cache.

Proposed resolution

Reset the config object in ConfigFactory via \Drupal::configFactory()->reset($entity->getConfigDependencyName()) when $entity instanceof ConfigEntityInterface in EntityTrait::reloadEntity(), and add kernel test coverage in EntityTraitTest.


AI Disclosure: Code, tests, and MR description were drafted with the assistance of an AI tool (Antigravity/LLM), and manually verified and tested.

Merge request reports

Loading
Loading