$this->accessManager->
expects($this->
any()) ->
method('checkNamedRoute'
) ->
willReturn(AccessResult::
allowed());
$this->moduleHandler->
expects($this->
exactly(2
)) ->
method('alter'
) ->
withConsecutive( ['contextual_links_plugins'
],
['contextual_links',
new Count(2
), 'group1',
['key' => 'value'
]],
);
$result =
$this->contextualLinkManager->
getContextualLinksArrayByGroup('group1',
['key' => 'value'
]);
$this->
assertCount(2,
$result);
foreach (['test_plugin1', 'test_plugin2'
] as $plugin_id) { $definition =
$definitions[$plugin_id];
$this->
assertEquals($definition['weight'
],
$result[$plugin_id]['weight'
]);
$this->
assertEquals($definition['title'
],
$result[$plugin_id]['title'
]);
$this->
assertEquals($definition['route_name'
],
$result[$plugin_id]['route_name'
]);
$this->
assertEquals($definition['options'
],
$result[$plugin_id]['localized_options'
]);
} } /**
* Tests the access checking of the getContextualLinksArrayByGroup method.
*
* @see \Drupal\Core\Menu\ContextualLinkManager::getContextualLinksArrayByGroup()
*/