Esempio n. 1
0
 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 testRemoveTag()
 {
     $tag = $this->dummyData->getTag();
     $product = $this->dummyData->getProduct();
     $product->addTag($tag);
     $this->productRepository->shouldReceive('findOneById')->andReturn($product);
     $this->tagRepository->shouldReceive('findOneById')->andReturn($tag);
     $this->productRepository->shouldReceive('update')->once();
     $this->productService->removeTag($product->getId(), $tag->getId());
     $this->assertCount(0, $product->getTags());
 }
Esempio n. 3
0
 public function testRemoveOption()
 {
     $tag1 = $this->dummyData->getTag();
     $this->tagRepository->shouldReceive('findOneById')->with($tag1->getId())->andReturn($tag1)->once();
     $option1 = $this->dummyData->getOption();
     $this->optionRepository->shouldReceive('findOneById')->with($option1->getId())->andReturn($option1)->once();
     $this->tagRepository->shouldReceive('update')->once();
     $this->tagService->removeOption($tag1->getId(), $option1->getId());
 }