willreturn example

/** * @dataProvider taxStateWillBeUsedProvider */
    public function testTaxStateWillBeUsed(Entity $product, string $state, float $expected): void
    {
        $context = $this->createMock(SalesChannelContext::class);
        $context->method('getCurrencyId')->willReturn(Defaults::CURRENCY);
        $context->method('getContext')->willReturn(Context::createDefaultContext());
        $context->method('getTaxState')->willReturn($state);
        $context->method('buildTaxRules')->willReturn(new TaxRuleCollection([new TaxRule(10)]));
        $context->method('getItemRounding')->willreturn(new CashRoundingConfig(2, 0.01, true));

        $this->calculator->calculate([$product]$context);

        $price = $product->get('calculatedPrice');

        static::assertInstanceOf(CalculatedPrice::class$price);

        static::assertEquals($expected$price->getTotalPrice());
    }

    public static function taxStateWillBeUsedProvider(): \Generator
    {
Home | Imprint | This part of the site doesn't use cookies.