You are here

protected function GroupContentPermissionProviderTest::createPermissionProvider in Group 8

Instantiates a default permission provider handler.

Return value

\Drupal\group\Plugin\GroupContentPermissionProvider The default permission provider handler.

12 calls to GroupContentPermissionProviderTest::createPermissionProvider()
GroupContentPermissionProviderTest::testBuildPermissions in tests/src/Unit/GroupContentPermissionProviderTest.php
Tests the permission builder.
GroupContentPermissionProviderTest::testGetAdminPermission in tests/src/Unit/GroupContentPermissionProviderTest.php
Tests the admin permission name.
GroupContentPermissionProviderTest::testGetEntityCreatePermission in tests/src/Unit/GroupContentPermissionProviderTest.php
Tests the entity create permission name.
GroupContentPermissionProviderTest::testGetEntityDeletePermission in tests/src/Unit/GroupContentPermissionProviderTest.php
Tests the entity delete permission name.
GroupContentPermissionProviderTest::testGetEntityUpdatePermission in tests/src/Unit/GroupContentPermissionProviderTest.php
Tests the entity update permission name.

... See full list

File

tests/src/Unit/GroupContentPermissionProviderTest.php, line 657

Class

GroupContentPermissionProviderTest
Tests the default GroupContentEnabler permission_provider handler.

Namespace

Drupal\Tests\group\Unit

Code

protected function createPermissionProvider($plugin_id, $definition, $implements_owner, $implements_published) {
  $this
    ->assertNotEmpty($definition['entity_type_id']);
  $entity_type = $this
    ->prophesize(EntityTypeInterface::class);
  $entity_type
    ->entityClassImplements(EntityOwnerInterface::class)
    ->willReturn($implements_owner);
  $entity_type
    ->entityClassImplements(EntityPublishedInterface::class)
    ->willReturn($implements_published);
  $entity_type
    ->getSingularLabel()
    ->willReturn('Bar');
  $entity_type_manager = $this
    ->prophesize(EntityTypeManagerInterface::class);
  $entity_type_manager
    ->getDefinition($definition['entity_type_id'])
    ->willReturn($entity_type
    ->reveal());
  $container = $this
    ->prophesize(ContainerInterface::class);
  $container
    ->get('entity_type.manager')
    ->willReturn($entity_type_manager
    ->reveal());
  return GroupContentPermissionProvider::createInstance($container
    ->reveal(), $plugin_id, $definition);
}