You are here

protected function GroupContentEnablerManagerTest::setUpPluginDefinitions in Group 8

Sets up the group content enabler manager to be tested.

Parameters

array $definitions: (optional) An array of group content enabler definitions.

5 calls to GroupContentEnablerManagerTest::setUpPluginDefinitions()
GroupContentEnablerManagerTest::testGetAccessControlHandler in tests/src/Unit/GroupContentEnablerManagerTest.php
Tests the getAccessControlHandler() method.
GroupContentEnablerManagerTest::testGetHandler in tests/src/Unit/GroupContentEnablerManagerTest.php
Tests the getHandler() method.
GroupContentEnablerManagerTest::testGetHandlerMissingHandler in tests/src/Unit/GroupContentEnablerManagerTest.php
Tests exception thrown when a plugin has not defined the requested handler.
GroupContentEnablerManagerTest::testGetPermissionProvider in tests/src/Unit/GroupContentEnablerManagerTest.php
Tests the getPermissionProvider() method.
GroupContentEnablerManagerTest::testHasHandler in tests/src/Unit/GroupContentEnablerManagerTest.php
Tests the hasHandler() method.

File

tests/src/Unit/GroupContentEnablerManagerTest.php, line 102

Class

GroupContentEnablerManagerTest
Tests the GroupContentEnabler plugin manager.

Namespace

Drupal\Tests\group\Unit

Code

protected function setUpPluginDefinitions($definitions = []) {
  $this->discovery
    ->getDefinition(Argument::cetera())
    ->will(function ($args) use ($definitions) {
    $plugin_id = $args[0];
    $exception_on_invalid = $args[1];
    if (isset($definitions[$plugin_id])) {
      return $definitions[$plugin_id];
    }
    elseif (!$exception_on_invalid) {
      return NULL;
    }
    else {
      throw new PluginNotFoundException($plugin_id);
    }
  });
  $this->discovery
    ->getDefinitions()
    ->willReturn($definitions);
}