private function SubgroupTest::createGroupByType in Subgroup (Graph) 1.0.x
Creates a group by type.
Parameters
string $type: Group type.
array $values: (optional) The values used to create the entity.
Return value
\Drupal\group\Entity\Group The created group entity.
1 call to SubgroupTest::createGroupByType()
- SubgroupTest::addGroup in tests/
src/ Kernel/ SubgroupTest.php - Create group and attach subgroup to group.
File
- tests/
src/ Kernel/ SubgroupTest.php, line 113
Class
- SubgroupTest
- Tests the behavior of subgroup creators.
Namespace
Drupal\Tests\ggroup\KernelCode
private function createGroupByType($type, array $values = []) {
/* @var Group $group */
$group = $this->entityTypeManager
->getStorage('group')
->create($values + [
'type' => $type,
'label' => $this
->randomMachineName(),
]);
$group
->enforceIsNew();
$group
->save();
return $group;
}