public function testCreateImageForTag() { $uploadFileDTO = $this->dummyData->getUploadFileDTO(); $managedFile = $this->dummyData->getLocalManagedFile(); $this->fileManager->shouldReceive('saveFile')->with($uploadFileDTO->getFilePath())->once()->andReturn($managedFile); $tag = $this->dummyData->getProduct(); $this->tagRepository->shouldReceive('findOneById')->with($tag->getId())->andReturn($tag)->once(); $this->imageRepository->shouldReceive('create')->once(); $this->imageService->createImageForTag($uploadFileDTO, $tag->getId()); }
public function testCreateAttachmentForOrderItem() { $order = $this->dummyData->getOrder(); $product = $this->dummyData->getProduct(); $product->enableAttachments(); $orderItem = $this->dummyData->getOrderItem($order, $product); $uploadFileDTO = $this->dummyData->getUploadFileDTO(); $this->orderService->shouldReceive('getOrderItemById')->with($orderItem->getId())->andReturn($orderItem)->once(); $this->fileManager->shouldReceive('saveFile')->with($uploadFileDTO->getFilePath())->andReturn($this->dummyData->getRemoteManagedFile())->once(); $this->attachmentRepository->shouldReceive('create')->once(); $this->orderService->shouldReceive('update')->with($order)->once(); $this->attachmentService->createAttachmentForOrderItem($uploadFileDTO, $orderItem->getId()); }