public function testIsTagValidWithNonMatchingTag()
 {
     $product = $this->dummyData->getProduct();
     $catalogPromotion = new CatalogPromotion();
     $catalogPromotion->setCode('20PCTOFF');
     $catalogPromotion->setTag(new Tag());
     $this->assertFalse($catalogPromotion->isTagValid($product));
 }
 public function handle(CreateCatalogPromotionCommand $command)
 {
     $catalogPromotion = new CatalogPromotion($command->getCatalogPromotionId());
     $catalogPromotion->setName($command->getName());
     $catalogPromotion->setType(PromotionType::createById($command->getPromotionTypeId()));
     $catalogPromotion->setValue($command->getValue());
     $catalogPromotion->setReducesTaxSubtotal($command->getReducesTaxSubtotal());
     $catalogPromotion->setMaxRedemptions($command->getMaxRedemptions());
     $catalogPromotion->setStart($command->getStartDate());
     $catalogPromotion->setEnd($command->getEndDate());
     if ($command->getTagId() !== null) {
         $tag = $this->tagService->findOneById($command->getTagId());
         $catalogPromotion->setTag($tag);
     }
     $this->catalogPromotionService->create($catalogPromotion);
 }