You are here

protected function ProductBehaviorSettingsFormTest::createEntityBundle in Rabbit Hole 8

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

Creates new entity bundle.

Return value

string ID of the created bundle.

Overrides RabbitHoleBehaviorSettingsFormTestBase::createEntityBundle

File

modules/rh_commerce/tests/src/Functional/ProductBehaviorSettingsFormTest.php, line 60

Class

ProductBehaviorSettingsFormTest
Test the functionality of the rabbit hole form additions to Commerce Product.

Namespace

Drupal\Tests\rh_commerce\Functional

Code

protected function createEntityBundle() {
  $storage = \Drupal::entityTypeManager()
    ->getStorage('commerce_product_type');
  $product_type = $storage
    ->create([
    'id' => mb_strtolower($this
      ->randomMachineName()),
    'label' => $this
      ->randomString(),
  ]);
  $storage
    ->save($product_type);
  $this->bundle = $product_type;
  return $product_type
    ->id();
}