Пример #1
0
 function it_returns_an_image_by_code(ImageInterface $image)
 {
     $image->getCode()->willReturn('thumbnail');
     $image->setOwner($this)->shouldBeCalled();
     $this->addImage($image);
     $this->getImageByCode('thumbnail')->shouldReturn($image);
 }
 function it_does_not_add_violation_if_there_is_no_duplication_of_a_code(ImageInterface $firstImage, ImageInterface $secondImage)
 {
     $firstImage->getCode()->willReturn('car');
     $secondImage->getCode()->willReturn('wipers');
     $this->addViolationAt('[0].code', Argument::type('string'))->shouldNotBeCalled();
     $this->addViolationAt('[1].code', Argument::type('string'))->shouldNotBeCalled();
     $this->validate(new ArrayCollection($firstImage->getWrappedObject(), $secondImage->getWrappedObject()), new ImageUniqueCode());
 }