public function OgMembershipTest::testIsRoleValidException in Organic groups 8
Tests the exception thrown if the validity of a role cannot be established.
@covers ::isRoleValid
File
- tests/src/ Kernel/ Entity/ OgMembershipTest.php, line 576 
Class
- OgMembershipTest
- Tests the OgMembership entity.
Namespace
Drupal\Tests\og\Kernel\EntityCode
public function testIsRoleValidException() {
  $role = OgRole::create([
    'group_type' => 'entity_test',
    'group_bundle' => 'entity_test',
  ]);
  $membership = OgMembership::create();
  // If a membership doesn't have a group yet it is not possible to determine
  // wheter a role is valid.
  $this
    ->expectException(\LogicException::class);
  $membership
    ->isRoleValid($role);
}