本文整理匯總了PHP中Pim\Component\Catalog\Model\ProductValueInterface::getOption方法的典型用法代碼示例。如果您正苦於以下問題:PHP ProductValueInterface::getOption方法的具體用法?PHP ProductValueInterface::getOption怎麽用?PHP ProductValueInterface::getOption使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pim\Component\Catalog\Model\ProductValueInterface
的用法示例。
在下文中一共展示了ProductValueInterface::getOption方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
function it_adds_violation_when_validating_group_containing_products_with_non_unique_combination_of_axis_attributes($context, GroupInterface $tShirtVariantGroup, GroupTypeInterface $tShirtGroupType, ProductInterface $redTShirtProduct, ProductInterface $redTShirtProduct2, AttributeInterface $sizeAttribute, AttributeInterface $colorAttribute, ProductValueInterface $sizeProductValue, ProductValueInterface $colorProductValue, UniqueVariantAxis $uniqueVariantAxisConstraint, ConstraintViolationBuilderInterface $violation)
{
$tShirtGroupType->isVariant()->willReturn(true);
$tShirtVariantGroup->getType()->willReturn($tShirtGroupType);
$tShirtVariantGroup->getProducts()->willReturn([$redTShirtProduct, $redTShirtProduct2]);
$tShirtVariantGroup->getAxisAttributes()->willReturn([$sizeAttribute, $colorAttribute]);
$sizeAttribute->getCode()->willReturn('size');
$colorAttribute->getCode()->willReturn('color');
$sizeProductValue->getOption()->willReturn('XL');
$colorProductValue->getOption()->willReturn('Red');
$redTShirtProduct->getValue('size')->willReturn($sizeProductValue);
$redTShirtProduct->getValue('color')->willReturn($colorProductValue);
$redTShirtProduct2->getValue('size')->willReturn($sizeProductValue);
$redTShirtProduct2->getValue('color')->willReturn($colorProductValue);
$tShirtVariantGroup->getLabel()->willReturn('Groupe TShirt');
$context->buildViolation('Group "%variant group%" already contains another product with values "%values%"', ['%variant group%' => 'Groupe TShirt', '%values%' => 'size: XL, color: Red'])->shouldBeCalled()->willReturn($violation);
$this->validate($tShirtVariantGroup, $uniqueVariantAxisConstraint);
}