CartVolumeRule example


#[Package('business-ops')] class CartVolumeRuleTest extends TestCase
{
    use CartRuleHelperTrait;
    use IntegrationTestBehaviour;

    private CartVolumeRule $rule;

    protected function setUp(): void
    {
        $this->rule = new CartVolumeRule();
    }

    /** * @dataProvider getMatchingRuleTestData */
    public function testIfMatchesCorrect(
        string $operator,
        float $volume,
        bool $expected
    ): void {
        $this->rule->assign(['volume' => $volume, 'operator' => $operator]);

        
'id' => $idsCollection->get('sequence-4'),
                        'parentId' => $idsCollection->get('sequence-3'),
                        'actionName' => null,
                        'config' => [],
                        'position' => 1,
                        'trueCase' => true,
                        'rule' => [
                            'name' => 'Test cart rule',
                            'priority' => 1,
                            'conditions' => [
                                [
                                    'type' => (new CartVolumeRule())->getName(),
                                    'value' => [
                                        'volume' => 8,
                                        'operator' => CartVolumeRule::OPERATOR_GT,
                                    ],
                                ],
                            ],
                        ],
                    ],
                    [
                        'id' => $idsCollection->get('sequence-5'),
                        'parentId' => $idsCollection->get('sequence-4'),
                        
Home | Imprint | This part of the site doesn't use cookies.