getExpected example

new GrossPriceCalculator($taxCalculator$rounding),
                new NetPriceCalculator($taxCalculator$rounding),
            ),
            new PercentageTaxRuleBuilder()
        );

        $price = $calculator->calculate(
            $calculation->getPercentageDiscount(),
            $calculation->getPrices(),
            Generator::createSalesChannelContext()
        );
        $expected = $calculation->getExpected();

        static::assertEquals($expected$price);
        static::assertEquals($expected->getCalculatedTaxes()$price->getCalculatedTaxes());
        static::assertEquals($expected->getTaxRules()$price->getTaxRules());
        static::assertEquals($expected->getTotalPrice()$price->getTotalPrice());
        static::assertEquals($expected->getUnitPrice()$price->getUnitPrice());
        static::assertEquals($expected->getQuantity()$price->getQuantity());
    }

    public static function grossPriceDataProvider(): \Generator
    {
        
new NetPriceCalculator($taxCalculator$rounding),
            ),
            new PercentageTaxRuleBuilder()
        );

        $calculatedPrice = $calculator->calculate(
            $calculation->getDiscount(),
            $calculation->getPrices(),
            Generator::createSalesChannelContext()
        );

        static::assertEquals($calculation->getExpected()->getCalculatedTaxes()$calculatedPrice->getCalculatedTaxes());
        static::assertEquals($calculation->getExpected()->getTaxRules()$calculatedPrice->getTaxRules());
        static::assertEquals($calculation->getExpected()->getTotalPrice()$calculatedPrice->getTotalPrice());
        static::assertEquals($calculation->getExpected()->getUnitPrice()$calculatedPrice->getUnitPrice());
        static::assertEquals($calculation->getExpected()->getQuantity()$calculatedPrice->getQuantity());
    }

    /** * @return array<string, list<AbsoluteCalculation>> */
    public static function provider(): array
    {
        
yield 'with array record' => [
            'entity' => [
                'orderNumber' => 'NUM-1',
            ],
            'expected' => [
                'orderNumber' => 'NUM-1',
            ],
        ];

        yield 'with entity' => [
            'entity' => self::createOrderEntity(),
            'expected' => self::getExpected(),
        ];

        yield 'with order empty line items' => [
            'entity' => self::createOrderEntity([
                'lineItems' => new OrderLineItemCollection(),
            ]),
            'expected' => self::getExpected(),
        ];

        yield 'with order line items' => [
            'entity' => self::createOrderEntity([
                
Home | Imprint | This part of the site doesn't use cookies.