You are here

public function GroupContentEnablerManagerTest::testHasHandler in Group 8

Tests the hasHandler() method.

@covers ::hasHandler @dataProvider providerTestHasHandler

Parameters

string $plugin_id: The ID of the plugin to check the handler for.

bool $expected: Whether the handler is expected to be found.

File

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

Class

GroupContentEnablerManagerTest
Tests the GroupContentEnabler plugin manager.

Namespace

Drupal\Tests\group\Unit

Code

public function testHasHandler($plugin_id, $expected) {
  $apple = [
    'handlers' => [
      'foo_handler' => TestGroupContentHandler::class,
    ],
  ];
  $banana = [
    'handlers' => [
      'foo_handler' => FALSE,
    ],
  ];
  $this
    ->setUpPluginDefinitions([
    'apple' => $apple,
    'banana' => $banana,
  ]);
  $this
    ->assertSame($expected, $this->groupContentEnablerManager
    ->hasHandler($plugin_id, 'foo_handler'));
}