You are here

protected function GroupManagerSubscriptionTest::isMembershipOverridden in Organic groups 8

Checks if the membership is overridden by a custom hook implementation.

Parameters

\Drupal\og\OgMembershipInterface $membership: The OG Membership to check. If empty the membership does not exist.

Return value

bool Whether or not the membership is overridden.

1 call to GroupManagerSubscriptionTest::isMembershipOverridden()
GroupManagerSubscriptionTest::testGroupManagerSubscription in tests/src/Kernel/GroupManagerSubscriptionTest.php
Tests whether a group manager is subscribed when creating a group.

File

tests/src/Kernel/GroupManagerSubscriptionTest.php, line 129

Class

GroupManagerSubscriptionTest
Tests if the group manager is subscribed automatically upon group creation.

Namespace

Drupal\Tests\og\Kernel

Code

protected function isMembershipOverridden(OgMembershipInterface $membership = NULL) {

  // If the membership doesn't exist it is not overridden.
  if (empty($membership)) {
    return FALSE;
  }

  // If the membership is overridden, it will have the 'moderator' role
  // assigned to it.
  // @see og_test_entity_insert()
  return $membership
    ->hasRole('node-group-moderator');
}