protected function GroupBehaviorInvocationTest::createEntityBundle in Rabbit Hole 8
Same name and namespace in other branches
- 2.x modules/rh_group/tests/src/Functional/GroupBehaviorInvocationTest.php \Drupal\Tests\rh_group\Functional\GroupBehaviorInvocationTest::createEntityBundle()
Creates new entity bundle.
Parameters
string $action: Rabbit Hole action.
Return value
string ID of the created bundle.
Overrides RabbitHoleBehaviorInvocationTestBase::createEntityBundle
File
- modules/
rh_group/ tests/ src/ Functional/ GroupBehaviorInvocationTest.php, line 35
Class
- GroupBehaviorInvocationTest
- Test that rabbit hole behaviors are invoked correctly for groups.
Namespace
Drupal\Tests\rh_group\FunctionalCode
protected function createEntityBundle($action = NULL) {
// TODO: Switch to trait when/if the patch is committed and released.
// See: https://www.drupal.org/project/group/issues/3177542
$storage = \Drupal::entityTypeManager()
->getStorage('group_type');
$group_type = $storage
->create([
'id' => mb_strtolower($this
->randomMachineName()),
'label' => $this
->randomString(),
]);
$storage
->save($group_type);
$this->groupType = $group_type;
if (isset($action)) {
$this->behaviorSettingsManager
->saveBehaviorSettings([
'action' => $action,
'allow_override' => TRUE,
], 'group_type', $this->groupType
->id());
}
return $this->groupType
->id();
}