Ejemplo n.º 1
0
 /**
  * Tests the plugin manager cache clear with tags.
  */
 public function testCacheClearWithTags()
 {
     $cid = $this->randomMachineName();
     $cache_backend = $this->getMock('Drupal\\Core\\Cache\\CacheBackendInterface');
     $cache_tags_invalidator = $this->getMock('Drupal\\Core\\Cache\\CacheTagsInvalidatorInterface');
     $cache_tags_invalidator->expects($this->once())->method('invalidateTags')->with(array('tag'));
     $cache_backend->expects($this->never())->method('deleteMultiple');
     $this->getContainerWithCacheTagsInvalidator($cache_tags_invalidator);
     $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions, NULL, NULL, '\\Drupal\\plugin_test\\Plugin\\plugin_test\\fruit\\FruitInterface');
     $plugin_manager->setCacheBackend($cache_backend, $cid, array('tag'));
     $plugin_manager->clearCachedDefinitions();
 }
Ejemplo n.º 2
0
 /**
  * Tests the plugin manager cache clear with tags.
  */
 public function testCacheClearWithTags()
 {
     $cid = $this->randomName();
     $cache_backend = $this->getMockBuilder('Drupal\\Core\\Cache\\MemoryBackend')->disableOriginalConstructor()->getMock();
     $cache_backend->expects($this->once())->method('deleteTags')->with(array('tag' => TRUE));
     $cache_backend->expects($this->never())->method('deleteMultiple');
     $this->getContainerWithCacheBins($cache_backend);
     $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions);
     $plugin_manager->setCacheBackend($cache_backend, $cid, array('tag' => TRUE));
     $plugin_manager->clearCachedDefinitions();
 }