コード例 #1
0
 function it_adds_violation_when_validates_non_string_product_value($context, IsString $stringConstraint, ProductValueInterface $productValue, AttributeInterface $attribute, ConstraintViolationBuilderInterface $violation)
 {
     $productValue->getAttribute()->willReturn($attribute);
     $attribute->getCode()->willReturn('foo');
     $attribute->getBackendType()->willReturn('integer');
     $productValue->getInteger()->willReturn(666);
     $context->buildViolation($stringConstraint->message, ['%attribute%' => 'foo', '%givenType%' => 'integer'])->shouldBeCalled()->willReturn($violation);
     $this->validate($productValue, $stringConstraint);
 }