function PluginManagerBaseTest::createInstanceCallback
Same name in other branches
- 9 core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php \Drupal\Tests\Component\Plugin\PluginManagerBaseTest::createInstanceCallback()
- 8.9.x core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php \Drupal\Tests\Component\Plugin\PluginManagerBaseTest::createInstanceCallback()
- 11.x core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php \Drupal\Tests\Component\Plugin\PluginManagerBaseTest::createInstanceCallback()
A callback method for mocking FactoryInterface objects.
File
-
core/
tests/ Drupal/ Tests/ Component/ Plugin/ PluginManagerBaseTest.php, line 24
Class
- PluginManagerBaseTest
- @coversDefaultClass \Drupal\Component\Plugin\PluginManagerBase @group Plugin
Namespace
Drupal\Tests\Component\PluginCode
public function createInstanceCallback() {
$args = func_get_args();
$plugin_id = $args[0];
$configuration = $args[1];
if ('invalid' == $plugin_id) {
throw new PluginNotFoundException($plugin_id);
}
return [
'plugin_id' => $plugin_id,
'configuration' => $configuration,
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.