You are here

protected function ProductVariationAttributeMapperTest::createAttributeValue in Commerce Core 8.2

Creates an attribute value.

Parameters

string $attribute: The attribute ID.

string $name: The attribute value name.

Return value

\Drupal\commerce_product\Entity\ProductAttributeValueInterface The attribute value entity.

1 call to ProductVariationAttributeMapperTest::createAttributeValue()
ProductVariationAttributeMapperTest::createAttributeSet in modules/product/tests/src/Kernel/ProductVariationAttributeMapperTest.php
Creates an attribute field and set of attribute values.

File

modules/product/tests/src/Kernel/ProductVariationAttributeMapperTest.php, line 681

Class

ProductVariationAttributeMapperTest
Tests the product variation attribute mapper.

Namespace

Drupal\Tests\commerce_product\Kernel

Code

protected function createAttributeValue($attribute, $name) {
  $attribute_value = ProductAttributeValue::create([
    'attribute' => $attribute,
    'name' => $name,
  ]);
  $attribute_value
    ->save();
  return $attribute_value;
}