CalculatedTaxes example

public static function calculationProvider(): \Generator
    {
        yield 'Test empty container will be removed' => [
            new ContainerItem(),
            null,
        ];

        yield 'Test container with one quantity price definition' => [
            new ContainerItem([
                new QuantityItem(20, new HighTaxes()),
            ]),
            new CalculatedPrice(20, 20, new CalculatedTaxes([19 => 3.19])new HighTaxes()),
        ];

        yield 'Test percentage discount for one item' => [
            new ContainerItem([
                new QuantityItem(20, new HighTaxes()),
                new PercentageItem(-10),
            ]),
            new CalculatedPrice(18, 18, new CalculatedTaxes([19 => 2.87])new HighTaxes()),
        ];

        yield 'Test absolute discount for one item' => [
            
new AbsoluteItem(-6, self::DISCOUNT_ID),
            ],
            null,
        ];

        yield 'Remove second discount when cart gets negative and check price' => [
            [
                new CalculatedItem(10, new HighTaxes()$context),
                new AbsoluteItem(-5, self::DISCOUNT_ID),
                new AbsoluteItem(-5),
            ],
            new CalculatedPrice(-5, -5, new CalculatedTaxes([19 => -0.8])new TaxRuleCollection()),
        ];

        yield 'Calculate discount for one item' => [
            [
                new CalculatedItem(10, new HighTaxes()$context),
                new PercentageItem(-10, self::DISCOUNT_ID),
            ],
            new CalculatedPrice(-1, -1, new CalculatedTaxes([19 => -0.16])new TaxRuleCollection()),
        ];

        yield 'Calculate absolute discount' => [
            [
Home | Imprint | This part of the site doesn't use cookies.