$error =
sprintf('Case "%s": Product with key %s not found',
$message,
$key);
static::
assertInstanceOf(SalesChannelProductEntity::
class,
$product,
$error);
$error =
sprintf('Case "%s": Product with key %s, no calculated price found',
$message,
$key);
static::
assertInstanceOf(CalculatedPrice::
class,
$product->
getCalculatedPrice(),
$error);
$error =
sprintf('Case "%s": Product with key %s, calculated price not match',
$message,
$key);
static::
assertEquals($assertion['price'
],
$product->
getCalculatedPrice()->
getUnitPrice(),
$error);
$error =
sprintf('Case "%s": Product with key %s, advanced prices count not match',
$message,
$key);
static::
assertEquals(\
count($assertion['prices'
]), \
count($product->
getCalculatedPrices()),
$error);
foreach ($assertion['prices'
] as $index =>
$expected) { $price =
$product->
getCalculatedPrices()->
get($index);
$error =
sprintf('Case "%s": Product with key %s, advanced prices with index %s not match',
$message,
$key,
$index);
static::
assertInstanceOf(CalculatedPrice::
class,
$price,
$error);
static::
assertEquals($expected,
$price->
getUnitPrice(),
$error);
} $error =
sprintf('Case "%s": Product with key %s, cheapest price not match',
$message,
$key);
static::
assertEquals($assertion['cheapest'
],
$product->
getCalculatedCheapestPrice()->
getUnitPrice(),
$error);
} }