You are here

protected function GroupBehaviorSettingsFormTest::createEntityBundle in Rabbit Hole 8

Same name and namespace in other branches
  1. 2.x modules/rh_group/tests/src/Functional/GroupBehaviorSettingsFormTest.php \Drupal\Tests\rh_group\Functional\GroupBehaviorSettingsFormTest::createEntityBundle()

Creates new entity bundle.

Return value

string ID of the created bundle.

Overrides RabbitHoleBehaviorSettingsFormTestBase::createEntityBundle

File

modules/rh_group/tests/src/Functional/GroupBehaviorSettingsFormTest.php, line 41

Class

GroupBehaviorSettingsFormTest
Test the functionality of the rabbit hole form additions to the Group.

Namespace

Drupal\Tests\rh_group\Functional

Code

protected function createEntityBundle() {

  // 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->bundle = $group_type;
  return $group_type
    ->id();
}