function DefaultPluginManagerTest::testDefaultPluginManagerWithDisabledModule
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php \Drupal\Tests\Core\Plugin\DefaultPluginManagerTest::testDefaultPluginManagerWithDisabledModule()
- 10 core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php \Drupal\Tests\Core\Plugin\DefaultPluginManagerTest::testDefaultPluginManagerWithDisabledModule()
- 11.x core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php \Drupal\Tests\Core\Plugin\DefaultPluginManagerTest::testDefaultPluginManagerWithDisabledModule()
Tests the plugin manager with a disabled module.
File
-
core/
tests/ Drupal/ Tests/ Core/ Plugin/ DefaultPluginManagerTest.php, line 88
Class
- DefaultPluginManagerTest
- Tests the DefaultPluginManager.
Namespace
Drupal\Tests\Core\PluginCode
public function testDefaultPluginManagerWithDisabledModule() {
$definitions = $this->expectedDefinitions;
$definitions['cherry'] = [
'id' => 'cherry',
'label' => 'Cherry',
'color' => 'red',
'class' => 'Drupal\\plugin_test\\Plugin\\plugin_test\\fruit\\Cherry',
'provider' => 'disabled_module',
];
$module_handler = $this->createMock('Drupal\\Core\\Extension\\ModuleHandlerInterface');
$module_handler->expects($this->once())
->method('moduleExists')
->with('disabled_module')
->willReturn(FALSE);
$plugin_manager = new TestPluginManager($this->namespaces, $definitions, $module_handler, 'test_alter_hook', '\\Drupal\\plugin_test\\Plugin\\plugin_test\\fruit\\FruitInterface');
$this->assertEmpty($plugin_manager->getDefinition('cherry', FALSE), 'Plugin information of a disabled module is not available');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.