protected function OgRoleCacheContextTest::createGroup in Organic groups 8
Return a group entity with the given entity type.
Parameters
string $entity_type_id: The entity type of the entity to create. Can be 'entity_test' or 'node'.
Return value
\Drupal\Core\Entity\ContentEntityInterface The entity.
1 call to OgRoleCacheContextTest::createGroup()
- OgRoleCacheContextTest::testMemberships in tests/
src/ Kernel/ Cache/ Context/ OgRoleCacheContextTest.php - Tests that the correct cache context key is returned for group members.
File
- tests/
src/ Kernel/ Cache/ Context/ OgRoleCacheContextTest.php, line 230
Class
- OgRoleCacheContextTest
- Tests the OG role cache context.
Namespace
Drupal\Tests\og\Kernel\Cache\ContextCode
protected function createGroup(string $entity_type_id) : ContentEntityInterface {
switch ($entity_type_id) {
case 'node':
$group = Node::create([
'title' => $this
->randomString(),
'type' => 'group',
]);
$group
->save();
break;
default:
$group = EntityTest::create([
'name' => $this
->randomString(),
'type' => 'group',
]);
$group
->save();
}
return $group;
}