'id' => 'test_plugin3',
'class' => '\Drupal\Core\Menu\ContextualLinkDefault',
'group' => 'group2',
'route_name' => 'test_router3',
],
];
$this->pluginDiscovery->
expects($this->
once()) ->
method('getDefinitions'
) ->
willReturn($definitions);
// Test with a non existing group.
$result =
$this->contextualLinkManager->
getContextualLinkPluginsByGroup('group_non_existing'
);
$this->
assertEmpty($result);
$result =
$this->contextualLinkManager->
getContextualLinkPluginsByGroup('group1'
);
$this->
assertEquals(['test_plugin1', 'test_plugin2'
],
array_keys($result));
$result =
$this->contextualLinkManager->
getContextualLinkPluginsByGroup('group2'
);
$this->
assertEquals(['test_plugin3'
],
array_keys($result));
} /**
* Tests the getContextualLinkPluginsByGroup method with a prefilled cache.
*/