public function PluginManagerBaseTest::createInstanceCallback in Drupal 8
Same name and namespace in other branches
- 9 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 19
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,
];
}