getMinQuantityRule example

$productLowQuantityHighPrice->setQuantity($minQuantity - 1);

        $productLowQuantityLowPrice = $this->createProductItem($minPrice - 0.1, 0);
        $productLowQuantityLowPrice->setId($productLowQuantity2Id);
        $productLowQuantityLowPrice->setReferencedId($productLowQuantity2Id);
        $productLowQuantityLowPrice->setQuantity($minQuantity - 1);

        $rulesMinPrice = new RuleEntity();
        $rulesMinPrice->setId(Uuid::randomBytes());
        $rulesMinPrice->setPayload(new OrRule(
            [
                $this->getMinQuantityRule($productHighQuantity1Id$minQuantity),
                $this->getMinQuantityRule($productHighQuantity2Id$minQuantity),
                $this->getMinQuantityRule($productLowQuantity1Id$minQuantity),
                $this->getMinQuantityRule($productLowQuantity2Id$minQuantity),
            ]
        ));

        $rulesMinQuantity = new RuleEntity();
        $rulesMinQuantity->setId(Uuid::randomBytes());
        $rulesMinQuantity->setPayload(new AndRule([$this->getMinPriceRule($minPrice)]));

        // create our group with our price and quantity rule


    /** * This test verifies that our property is correctly * assigned and returned in its getter. * * @group lineitemgroup */
    public function testRulesProperty(): void
    {
        $ruleEntity = $this->buildRuleEntity(
            $this->getMinQuantityRule(Uuid::randomBytes(), 2)
        );

        $ruleCollection = new RuleCollection([$ruleEntity]);

        $group = new LineItemGroupDefinition('ID-1', 'COUNT', 2, 'PRICE_ASC', $ruleCollection);

        static::assertSame($ruleCollection$group->getRules());
    }
}
Home | Imprint | This part of the site doesn't use cookies.