Commit 5a231af7 authored by alexpott's avatar alexpott
Browse files

Issue #2504993 by Xano: HookDiscovery sets "module" instead of "provider" in plugin definitions

parent f0342329
...@@ -54,7 +54,7 @@ public function getDefinitions() { ...@@ -54,7 +54,7 @@ public function getDefinitions() {
foreach ($this->moduleHandler->getImplementations($this->hook) as $module) { foreach ($this->moduleHandler->getImplementations($this->hook) as $module) {
$result = $this->moduleHandler->invoke($module, $this->hook); $result = $this->moduleHandler->invoke($module, $this->hook);
foreach ($result as $plugin_id => $definition) { foreach ($result as $plugin_id => $definition) {
$definition['module'] = $module; $definition['provider'] = $module;
$definitions[$plugin_id] = $definition; $definitions[$plugin_id] = $definition;
} }
} }
......
...@@ -80,9 +80,9 @@ public function testGetDefinitions() { ...@@ -80,9 +80,9 @@ public function testGetDefinitions() {
$this->assertEquals($definitions['test_id_3']['class'], 'Drupal\plugin_test\Plugin\plugin_test\fruit\Cherry'); $this->assertEquals($definitions['test_id_3']['class'], 'Drupal\plugin_test\Plugin\plugin_test\fruit\Cherry');
// Ensure that the module was set. // Ensure that the module was set.
$this->assertEquals($definitions['test_id_1']['module'], 'hook_discovery_test'); $this->assertEquals($definitions['test_id_1']['provider'], 'hook_discovery_test');
$this->assertEquals($definitions['test_id_2']['module'], 'hook_discovery_test'); $this->assertEquals($definitions['test_id_2']['provider'], 'hook_discovery_test');
$this->assertEquals($definitions['test_id_3']['module'], 'hook_discovery_test2'); $this->assertEquals($definitions['test_id_3']['provider'], 'hook_discovery_test2');
} }
/** /**
...@@ -108,15 +108,15 @@ public function testGetDefinition() { ...@@ -108,15 +108,15 @@ public function testGetDefinition() {
$plugin_definition = $this->hookDiscovery->getDefinition('test_id_1'); $plugin_definition = $this->hookDiscovery->getDefinition('test_id_1');
$this->assertEquals($plugin_definition['class'], 'Drupal\plugin_test\Plugin\plugin_test\fruit\Apple'); $this->assertEquals($plugin_definition['class'], 'Drupal\plugin_test\Plugin\plugin_test\fruit\Apple');
$this->assertEquals($plugin_definition['module'], 'hook_discovery_test'); $this->assertEquals($plugin_definition['provider'], 'hook_discovery_test');
$plugin_definition = $this->hookDiscovery->getDefinition('test_id_2'); $plugin_definition = $this->hookDiscovery->getDefinition('test_id_2');
$this->assertEquals($plugin_definition['class'], 'Drupal\plugin_test\Plugin\plugin_test\fruit\Orange'); $this->assertEquals($plugin_definition['class'], 'Drupal\plugin_test\Plugin\plugin_test\fruit\Orange');
$this->assertEquals($plugin_definition['module'], 'hook_discovery_test'); $this->assertEquals($plugin_definition['provider'], 'hook_discovery_test');
$plugin_definition = $this->hookDiscovery->getDefinition('test_id_3'); $plugin_definition = $this->hookDiscovery->getDefinition('test_id_3');
$this->assertEquals($plugin_definition['class'], 'Drupal\plugin_test\Plugin\plugin_test\fruit\Cherry'); $this->assertEquals($plugin_definition['class'], 'Drupal\plugin_test\Plugin\plugin_test\fruit\Cherry');
$this->assertEquals($plugin_definition['module'], 'hook_discovery_test2'); $this->assertEquals($plugin_definition['provider'], 'hook_discovery_test2');
} }
/** /**
......
Markdown is supported
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