You are here

public function GroupContentAccessControlHandlerTest::testCreateInstanceException in Group 8

Tests the exception thrown when there is no permission provider.

File

tests/src/Unit/GroupContentAccessControlHandlerTest.php, line 57

Class

GroupContentAccessControlHandlerTest
Tests the default GroupContentEnabler access handler.

Namespace

Drupal\Tests\group\Unit

Code

public function testCreateInstanceException() {
  $manager = $this
    ->prophesize(GroupContentEnablerManagerInterface::class);
  $manager
    ->hasHandler('foo', 'permission_provider')
    ->willReturn(FALSE);
  $this->container
    ->get('plugin.manager.group_content_enabler')
    ->willReturn($manager
    ->reveal());
  $this
    ->expectException(\LogicException::class);
  $this
    ->expectExceptionMessage('Cannot use an "access" handler without a "permission_provider" handler.');
  GroupContentAccessControlHandler::createInstance($this->container
    ->reveal(), 'foo', []);
}