protected function ProductAttributeTestTrait::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.
3 calls to ProductAttributeTestTrait::createAttributeValue()
- MultipleCartMultipleVariationTypesTest::setUp in modules/
cart/ tests/ src/ Functional/ MultipleCartMultipleVariationTypesTest.php - MultipleCartMultipleVariationTypesTest::setUp in modules/
cart/ tests/ src/ FunctionalJavascript/ MultipleCartMultipleVariationTypesTest.php - ProductAttributeTestTrait::createAttributeSet in modules/
product/ tests/ src/ Traits/ ProductAttributeTestTrait.php - Creates an attribute field and set of attribute values.
File
- modules/
product/ tests/ src/ Traits/ ProductAttributeTestTrait.php, line 96
Class
- ProductAttributeTestTrait
- Defines a trait for attribute-related functional tests.
Namespace
Drupal\Tests\commerce_product\TraitsCode
protected function createAttributeValue($attribute, $name) {
$attribute_value = $this
->createEntity('commerce_product_attribute_value', [
'attribute' => $attribute,
'name' => $name,
]);
$attribute_value
->save();
return $attribute_value;
}