pluginManager = \Drupal::service('plugin.manager.migration'); } /** * Tests cache invalidation. */ public function testCacheInvalidation() { $config = Migration::create([ 'id' => 'test', 'label' => 'Label A', 'migration_tags' => [], 'source' => [], 'destination' => [], 'migration_dependencies' => [], ]); $config->save(); $this->assertTrue($this->pluginManager->getDefinition('test')); $this->assertSame('Label A', $this->pluginManager->getDefinition('test')['label']); // Clear static cache in the plugin manager, the cache tag take care of the // persistent cache. $this->pluginManager->useCaches(FALSE); $this->pluginManager->useCaches(TRUE); $config->set('label', 'Label B'); $config->save(); $this->assertSame('Label B', $this->pluginManager->getDefinition('test')['label']); } }