function DefaultPluginManagerTest::testDefaultPluginManagerWithObjects
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php \Drupal\Tests\Core\Plugin\DefaultPluginManagerTest::testDefaultPluginManagerWithObjects()
- 10 core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php \Drupal\Tests\Core\Plugin\DefaultPluginManagerTest::testDefaultPluginManagerWithObjects()
- 11.x core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php \Drupal\Tests\Core\Plugin\DefaultPluginManagerTest::testDefaultPluginManagerWithObjects()
Tests the plugin manager and object plugin definitions.
File
-
core/
tests/ Drupal/ Tests/ Core/ Plugin/ DefaultPluginManagerTest.php, line 113
Class
- DefaultPluginManagerTest
- Tests the DefaultPluginManager.
Namespace
Drupal\Tests\Core\PluginCode
public function testDefaultPluginManagerWithObjects() {
$definitions = $this->expectedDefinitions;
$definitions['cherry'] = (object) [
'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 is available');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.