CodeExplorer Calculator example
private SalesChannelContext
$context;
protected function setUp(): void
{ $cashRounding =
new CashRounding();
$percentageTaxRuleBuilder =
new PercentageTaxRuleBuilder();
$quantityPriceCalculator =
new QuantityPriceCalculator( new GrossPriceCalculator(new TaxCalculator(),
$cashRounding),
new NetPriceCalculator(new TaxCalculator(),
$cashRounding),
);
$this->calculator =
new Calculator( $quantityPriceCalculator,
new PercentagePriceCalculator($cashRounding,
$quantityPriceCalculator,
$percentageTaxRuleBuilder),
new AbsolutePriceCalculator($quantityPriceCalculator,
$percentageTaxRuleBuilder) );
$this->context =
$this->
createMock(SalesChannelContext::
class);
$this->context->
method('getItemRounding'
)->
willReturn(new CashRoundingConfig(2, 0.01, true
));
} public function testCalculateSimplePrice(): void
{