Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getOneHundredPercentageDiscountCase example
static
::
assertEquals
(
$calculation
->
getExpected
(
)
->
getUnitPrice
(
)
,
$calculatedPrice
->
getUnitPrice
(
)
)
;
static
::
assertEquals
(
$calculation
->
getExpected
(
)
->
getQuantity
(
)
,
$calculatedPrice
->
getQuantity
(
)
)
;
}
/** * @return array<string, list<AbsoluteCalculation>> */
public
static
function
provider
(
)
: array
{
return
[
'small-discounts' =>
[
self::
getSmallDiscountCase
(
)
]
,
'100%' =>
[
self::
getOneHundredPercentageDiscountCase
(
)
]
,
]
;
}
private
static
function
getSmallDiscountCase
(
)
: AbsoluteCalculation
{
$calculator
= self::
createQuantityPriceCalculator
(
)
;
$definition
=
new
QuantityPriceDefinition
(
30,
new
TaxRuleCollection
(
[
new
TaxRule
(
19
)
]
)
)
;
$price1
=
$calculator
->
calculate
(
$definition
, Generator::
createSalesChannelContext
(
)
)
;
$definition
=
new
QuantityPriceDefinition
(
30,
new
TaxRuleCollection
(
[
new
TaxRule
(
7
)
]
)
)
;