public function OgMembershipTest::testIsRoleValid in Organic groups 8
Tests if it is possible to check if a role is valid for a membership.
@covers ::isRoleValid @dataProvider isRoleValidProvider
File
- tests/
src/ Kernel/ Entity/ OgMembershipTest.php, line 378
Class
- OgMembershipTest
- Tests the OgMembership entity.
Namespace
Drupal\Tests\og\Kernel\EntityCode
public function testIsRoleValid($group_type, $group_bundle, $role_name, $expected) {
$role = OgRole::create([
'group_type' => $group_type,
'group_bundle' => $group_bundle,
'name' => $role_name,
]);
$group = EntityTest::create([
'type' => 'entity_test',
'name' => $this
->randomString(),
]);
$group
->save();
$membership = OgMembership::create()
->setGroup($group);
$this
->assertEquals($expected, $membership
->isRoleValid($role));
}