assertRuleMatches example

public function testFilter(): void
    {
        $item = $this->createLineItemWithPrice('test-not-matching', 40);
        $item->setGood(true);

        $item2 = $this->createLineItemWithPrice('test', 100);
        $item2->setGood(true);

        $cart = $this->createCart(new LineItemCollection([$item$item2]));

        $this->assertRuleMatches($cart);
    }

    public function testFilterNested(): void
    {
        $item = $this->createLineItemWithPrice('test-not-matching', 40);
        $item->setGood(true);

        $item2 = $this->createLineItemWithPrice('test', 100);
        $item2->setGood(true);

        $containerLineItem = $this->createContainerLineItem(new LineItemCollection([$item$item2]));
        
static::assertInstanceOf(AndRule::class$filterRule);
        static::assertInstanceOf(PromotionCodeOfTypeRule::class$filterRule->getRules()[0]);
    }

    public function testFilter(): void
    {
        $item = $this->createLineItemWithPrice(LineItem::PROMOTION_LINE_ITEM_TYPE, -40)->setPayloadValue('promotionCodeType', 'fixed');
        $item2 = $this->createLineItemWithPrice(LineItem::PROMOTION_LINE_ITEM_TYPE, -100)->setPayloadValue('promotionCodeType', 'global');

        $cart = $this->createCart(new LineItemCollection([$item$item2]));

        $this->assertRuleMatches($cart);
    }

    public function testFilterNested(): void
    {
        $item = $this->createLineItemWithPrice(LineItem::PROMOTION_LINE_ITEM_TYPE, -40)->setPayloadValue('promotionCodeType', 'fixed');
        $item2 = $this->createLineItemWithPrice(LineItem::PROMOTION_LINE_ITEM_TYPE, -100)->setPayloadValue('promotionCodeType', 'global');

        $containerLineItem = $this->createContainerLineItem(new LineItemCollection([$item$item2]));
        $cart = $this->createCart(new LineItemCollection([$containerLineItem]));

        $this->assertRuleMatches($cart);
    }
$item = $this->createLineItemWithPrice('test', 40);
        $item->setGood(true);

        $item2 = $this->createLineItemWithPrice('test', 100);
        $item2->setGood(true);

        $item3 = $this->createLineItemWithPrice('test-not-matching', 30);
        $item3->setGood(true);

        $cart = $this->createCart(new LineItemCollection([$item$item2$item3]));

        $this->assertRuleMatches($cart);
    }

    public function testFilterNested(): void
    {
        $item = $this->createLineItemWithPrice('test', 40);
        $item->setGood(true);

        $item2 = $this->createLineItemWithPrice('test', 100);
        $item2->setGood(true);

        $item3 = $this->createLineItemWithPrice('test-not-matching', 30);
        
Home | Imprint | This part of the site doesn't use cookies.