public function __construct(AbstractPromotion $promotion, DTOBuilderFactoryInterface $dtoBuilderFactory)
 {
     $this->entity = $promotion;
     $this->dtoBuilderFactory = $dtoBuilderFactory;
     $this->entityDTO = $this->getEntityDTO();
     $this->setId();
     $this->setTime();
     $this->setStartEndDate();
     $this->setRedemption();
     $this->entityDTO->name = $this->entity->getName();
     $this->entityDTO->value = $this->entity->getValue();
     $this->entityDTO->reducesTaxSubtotal = $this->entity->getReducesTaxSubtotal();
     $this->entityDTO->isRedemptionCountValid = $this->entity->isRedemptionCountValid();
     $this->entityDTO->type = $this->dtoBuilderFactory->getPromotionTypeDTOBuilder($this->entity->getType())->build();
 }
 public function testIsRedemptionCountValid()
 {
     $this->promotion->setMaxRedemptions(null);
     $this->assertTrue($this->promotion->isRedemptionCountValid());
     $this->promotion->setMaxRedemptions(10);
     $this->promotion->setRedemptions(0);
     $this->assertTrue($this->promotion->isRedemptionCountValid());
     $this->promotion->setRedemptions(9);
     $this->assertTrue($this->promotion->isRedemptionCountValid());
     $this->promotion->setRedemptions(10);
     $this->assertFalse($this->promotion->isRedemptionCountValid());
     $this->promotion->setRedemptions(15);
     $this->assertFalse($this->promotion->isRedemptionCountValid());
 }