public function testGetOptionProductById()
 {
     $option = $this->dummyData->getOption();
     $product = $this->dummyData->getProduct();
     $optionProduct1 = $this->dummyData->getOptionProduct($option, $product);
     $this->entityManager->persist($option);
     $this->entityManager->persist($product);
     $this->entityManager->persist($optionProduct1);
     $this->entityManager->flush();
     $this->entityManager->clear();
     $optionProduct = $this->optionRepository->getOptionProductById($optionProduct1->getId());
     $this->assertEntitiesEqual($optionProduct1, $optionProduct);
 }
Exemple #2
0
 /**
  * @param UuidInterface $tagId
  * @param UuidInterface $optionId
  * @throws EntityNotFoundException
  */
 public function removeOption(UuidInterface $tagId, UuidInterface $optionId)
 {
     $option = $this->optionRepository->findOneById($optionId);
     $tag = $this->tagRepository->findOneById($tagId);
     $tag->removeOption($option);
     $this->tagRepository->update($tag);
 }
 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());
 }
 /**
  * @param string $queryString
  * @param Pagination $pagination
  * @return Option[]
  */
 public function getAllOptions($queryString = null, Pagination &$pagination = null)
 {
     $options = $this->optionRepository->getAllOptions($queryString, $pagination);
     return $options;
 }