/** * Should be able to attach images. */ public function testAttachImages() { /** @var BelongsToMany|MockObject $relationship */ $relationship = $this->makeMock(BelongsToMany::class); $this->product->setImagesRelationship($relationship); $imageIDs = [$this->generator()->anyInteger(), $this->generator()->anyInteger()]; $relationship->expects($this->atLeastOnce())->method('attach')->with($imageIDs); $this->product->attachImages($imageIDs); }