public function testFindOneById() { $image1 = $this->dummyData->getTag(); $this->imageRepository->shouldReceive('findOneById')->with($image1->getId())->andReturn($image1)->once(); $image = $this->imageService->findOneById($image1->getId()); $this->assertEntitiesEqual($image1, $image); }
public function testRemoveImage() { $tag1 = $this->dummyData->getTag(); $this->tagRepository->shouldReceive('findOneById')->with($tag1->getId())->andReturn($tag1)->once(); $image1 = $this->dummyData->getImage(); $this->imageRepository->shouldReceive('findOneById')->with($image1->getId())->andReturn($image1)->once(); $this->tagRepository->shouldReceive('update')->once(); $this->imageRepository->shouldReceive('delete')->with($image1)->once(); $this->tagService->removeImage($tag1->getId(), $image1->getId()); }
public function testRemoveImage() { $image = $this->dummyData->getImage(); $product = $this->dummyData->getProduct(); $product->addImage($image); $this->imageRepository->shouldReceive('findOneById')->andReturn($image); $this->productRepository->shouldReceive('findOneById')->andReturn($product); $this->productRepository->shouldReceive('update')->with($product)->once(); $this->imageRepository->shouldReceive('delete')->with($image)->once(); $this->productService->removeImage($product->getId(), $image->getId()); }