Verified Commit 4df43e48 authored by Dave Long's avatar Dave Long
Browse files

Issue #3335145 by catch, Berdir: Unnecessary workflow plugin manager cache tag

parent 86bced91
......@@ -76,8 +76,7 @@ protected function checkCreateAccess(AccountInterface $account, array $context,
// Allow access if there is at least one workflow type. Since workflow types
// are provided by modules this is cacheable until extensions change.
return $admin_access
->andIf(AccessResult::allowedIf($workflow_types_count > 0))
->addCacheTags(['workflow_type_plugins']);
->andIf(AccessResult::allowedIf($workflow_types_count > 0));
}
}
......@@ -30,7 +30,7 @@ class WorkflowTypeManager extends DefaultPluginManager {
public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
parent::__construct('Plugin/WorkflowType', $namespaces, $module_handler, WorkflowTypeInterface::class, WorkflowType::class);
$this->alterInfo('workflow_type_info');
$this->setCacheBackend($cache_backend, 'workflow_type_info', ['workflow_type_plugins']);
$this->setCacheBackend($cache_backend, 'workflow_type_info');
}
}
......@@ -75,14 +75,12 @@ public function testCheckCreateAccess() {
$this->assertEquals(
AccessResult::neutral()
->addCacheContexts(['user.permissions'])
->setReason("The 'administer workflows' permission is required.")
->addCacheTags(['workflow_type_plugins']),
->setReason("The 'administer workflows' permission is required."),
$this->accessControlHandler->createAccess(NULL, $this->user, [], TRUE)
);
$this->assertEquals(
AccessResult::allowed()
->addCacheContexts(['user.permissions'])
->addCacheTags(['workflow_type_plugins']),
->addCacheContexts(['user.permissions']),
$this->accessControlHandler->createAccess(NULL, $this->adminUser, [], TRUE)
);
......@@ -92,8 +90,7 @@ public function testCheckCreateAccess() {
$this->accessControlHandler->resetCache();
$this->assertEquals(
AccessResult::neutral()
->addCacheContexts(['user.permissions'])
->addCacheTags(['workflow_type_plugins']),
->addCacheContexts(['user.permissions']),
$this->accessControlHandler->createAccess(NULL, $this->adminUser, [], TRUE)
);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment