You are here

public function ContextualLinkManagerTest::testPluginDefinitionAlter in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Menu/ContextualLinkManagerTest.php \Drupal\Tests\Core\Menu\ContextualLinkManagerTest::testPluginDefinitionAlter()

Tests the plugins alter hook.

File

core/tests/Drupal/Tests/Core/Menu/ContextualLinkManagerTest.php, line 389
Contains \Drupal\Tests\Core\Menu\ContextualLinkManagerTest.

Class

ContextualLinkManagerTest
@coversDefaultClass \Drupal\Core\Menu\ContextualLinkManager @group Menu

Namespace

Drupal\Tests\Core\Menu

Code

public function testPluginDefinitionAlter() {
  $definitions['test_plugin'] = array(
    'id' => 'test_plugin',
    'class' => '\\Drupal\\Core\\Menu\\ContextualLinkDefault',
    'title' => 'Plugin',
    'weight' => 2,
    'group' => 'group1',
    'route_name' => 'test_route',
    'options' => array(
      'key' => 'value',
    ),
  );
  $this->pluginDiscovery
    ->expects($this
    ->once())
    ->method('getDefinitions')
    ->will($this
    ->returnValue($definitions));
  $this->moduleHandler
    ->expects($this
    ->once())
    ->method('alter')
    ->with('contextual_links_plugins', $definitions);
  $this->contextualLinkManager
    ->getDefinition('test_plugin');
}