PromotionCodeTuple example

/** * This test verifies that our code is correctly * assigned in the tuple and our getter * does return that value. * * @group promotions */
    public function testCode(): void
    {
        $promotion1 = new PromotionEntity();

        $tuple = new PromotionCodeTuple('codeA', $promotion1);

        static::assertEquals('codeA', $tuple->getCode());
    }

    /** * This test verifies that our promotion is correctly * assigned in the tuple and our getter * does return that object. * * @group promotions */
    
/** * Gets a list of all added automatic and * code promotions. */
    public function getPromotionCodeTuples(): array
    {
        $list = [];

        /** @var PromotionEntity $promotion */
        foreach ($this->automaticPromotions as $promotion) {
            $list[] = new PromotionCodeTuple('', $promotion);
        }

        foreach ($this->codePromotions as $code => $promotionList) {
            /** @var PromotionEntity $promotion */
            foreach ($promotionList as $promotion) {
                $list[] = new PromotionCodeTuple((string) $code$promotion);
            }
        }

        return $list;
    }

    
Home | Imprint | This part of the site doesn't use cookies.