function DefaultPluginManagerTest::testCacheClearWithTags

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php \Drupal\Tests\Core\Plugin\DefaultPluginManagerTest::testCacheClearWithTags()
  2. 8.9.x core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php \Drupal\Tests\Core\Plugin\DefaultPluginManagerTest::testCacheClearWithTags()
  3. 10 core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php \Drupal\Tests\Core\Plugin\DefaultPluginManagerTest::testCacheClearWithTags()

Tests the plugin manager cache clear with tags.

File

core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php, line 255

Class

DefaultPluginManagerTest
Tests the DefaultPluginManager.

Namespace

Drupal\Tests\Core\Plugin

Code

public function testCacheClearWithTags() : void {
  $cid = $this->randomMachineName();
  $cache_backend = $this->createMock('Drupal\\Core\\Cache\\CacheBackendInterface');
  $cache_tags_invalidator = $this->createMock('Drupal\\Core\\Cache\\CacheTagsInvalidatorInterface');
  $cache_tags_invalidator->expects($this->once())
    ->method('invalidateTags')
    ->with([
    'tag',
  ]);
  $cache_backend->expects($this->never())
    ->method('deleteMultiple');
  $this->getContainerWithCacheTagsInvalidator($cache_tags_invalidator);
  $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions, NULL, NULL, FruitInterface::class);
  $plugin_manager->setCacheBackend($cache_backend, $cid, [
    'tag',
  ]);
  $plugin_manager->clearCachedDefinitions();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.