You are here

public function PluginManagerBaseTest::createInstanceCallback in Drupal 9

Same name and namespace in other branches
  1. 8 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 22

Class

PluginManagerBaseTest
@coversDefaultClass \Drupal\Component\Plugin\PluginManagerBase @group Plugin

Namespace

Drupal\Tests\Component\Plugin

Code

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,
  ];
}