You are here

protected function GroupCreatorTest::getCreatorRoles in Group 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Kernel/GroupCreatorTest.php \Drupal\Tests\group\Kernel\GroupCreatorTest::getCreatorRoles()

Gets the roles for the group creator account's membership.

Parameters

\Drupal\Core\Session\AccountInterface $account: The account to load the group role entities for.

\Drupal\group\Entity\GroupInterface $group: The group entity to find the user's role entities in.

Return value

\Drupal\group\Entity\GroupRoleInterface[] The group roles matching the criteria.

2 calls to GroupCreatorTest::getCreatorRoles()
GroupCreatorTest::testCreatorGetsMembership in tests/src/Kernel/GroupCreatorTest.php
Tests that a group creator is automatically a member.
GroupCreatorTest::testCreatorRoles in tests/src/Kernel/GroupCreatorTest.php
Tests that a group creator gets the configured roles.

File

tests/src/Kernel/GroupCreatorTest.php, line 30

Class

GroupCreatorTest
Tests the behavior of group creators.

Namespace

Drupal\Tests\group\Kernel

Code

protected function getCreatorRoles(AccountInterface $account, GroupInterface $group) {

  /** @var \Drupal\group\Entity\Storage\GroupRoleStorageInterface $group_role_storage */
  $group_role_storage = $this->entityTypeManager
    ->getStorage('group_role');
  return $group_role_storage
    ->loadByUserAndGroup($account, $group, FALSE);
}