From d9a318b2c867a5c146ded45c5d94f5ccd44b5f6b Mon Sep 17 00:00:00 2001
From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org>
Date: Thu, 5 Feb 2015 12:46:44 +0000
Subject: [PATCH] Issue #2419005 by dawehner, alexpott: Aggregator: Uncaught
 PHP Exception Drupal\Component\Plugin\Exception\PluginNotFoundException: "The
 "FeedTitle" plugin does not exist."

---
 core/core.services.yml                              |  2 ++
 .../src/Tests/Entity/EntityValidationTest.php       | 13 +++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/core/core.services.yml b/core/core.services.yml
index 1fed8e1a8418..9f5d6fc325bb 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -508,6 +508,8 @@ services:
   validation.constraint:
     class: Drupal\Core\Validation\ConstraintManager
     parent: default_plugin_manager
+    tags:
+      - { name: plugin_manager_cache_clear }
   lock:
     class: Drupal\Core\Lock\DatabaseLockBackend
     arguments: ['@database']
diff --git a/core/modules/system/src/Tests/Entity/EntityValidationTest.php b/core/modules/system/src/Tests/Entity/EntityValidationTest.php
index 719b78336f89..44c90316365e 100644
--- a/core/modules/system/src/Tests/Entity/EntityValidationTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityValidationTest.php
@@ -79,6 +79,19 @@ protected function createTestEntity($entity_type) {
    * Tests validating test entity types.
    */
   public function testValidation() {
+    // Ensure that the constraint manager is marked as cached cleared.
+    $plugin_cache_clearer = \Drupal::service('plugin.cache_clearer');
+    $get_cached_discoveries = function () {
+      return $this->cachedDiscoveries;
+    };
+    $get_cached_discoveries = $get_cached_discoveries->bindTo($plugin_cache_clearer, $plugin_cache_clearer);
+    $cached_discoveries = $get_cached_discoveries();
+    $cached_discovery_classes = [];
+    foreach ($cached_discoveries as $cached_discovery) {
+      $cached_discovery_classes[] = get_class($cached_discovery);
+    }
+    $this->assertTrue(in_array('Drupal\Core\Validation\ConstraintManager', $cached_discovery_classes));
+
     // All entity variations have to have the same results.
     foreach (entity_test_entity_types() as $entity_type) {
       $this->checkValidation($entity_type);
-- 
GitLab