function it_validates_a_product_value_with_backendtype_as_media($context, ProductValueComplete $constraint, ProductValueInterface $productValue, AttributeInterface $attribute) { $constraint->getChannel()->willReturn($this->getChannel()); $productMedia = new FileInfo(); $productMedia->setOriginalFilename('akeneo.jpg'); $productValue->getMedia()->willReturn($productMedia); $productValue->getData()->willReturn('data'); $attribute->getBackendType()->willReturn('media'); $productValue->getAttribute()->willReturn($attribute); $context->buildViolation(Argument::any())->shouldNotBeCalled(); $this->validate($productValue, $constraint); }
public function it_succesfully_checks_complete_media(ProductValueInterface $value, ChannelInterface $channel, LocaleInterface $locale, FileInfo $media) { $value->getMedia()->willReturn(null); $this->isComplete($value, $channel, $locale)->shouldReturn(false); $value->getMedia()->willReturn([]); $this->isComplete($value, $channel, $locale)->shouldReturn(false); $media->__toString()->willReturn(''); $value->getMedia()->willReturn($media); $this->isComplete($value, $channel, $locale)->shouldReturn(false); $media->__toString()->willReturn('other'); $value->getMedia()->willReturn($media); $this->isComplete($value, $channel, $locale)->shouldReturn(true); }
/** * {@inheritDoc} */ public function __toString() { $this->__initializer__ && $this->__initializer__->__invoke($this, '__toString', array()); return parent::__toString(); }