/**
* Prepares all conditions for the given error to occur on a cart page visit.
*/
private function prepareErrors( Error
$error,
KernelBrowser
$browser,
string
$salesChannelId,
string
$productId,
bool
$shouldSwitchToDefault ): void
{ $availabilityRuleId =
$this->
createAvailabilityRule($salesChannelId);
$salesChannelRepository =
$this->
getContainer()->
get('sales_channel.repository'
);
if ($error instanceof ShippingMethodChangedError
) { $shippingMethodRepository =
$this->
getContainer()->
get('shipping_method.repository'
);
$blockedId =
$this->
getShippingMethodIdByName($error->
getOldShippingMethodName());
$newId =
$this->
getShippingMethodIdByName($error->
getNewShippingMethodName());
$shippingMethodRepository->
update([ [ 'id' =>
$blockedId,
'availabilityRuleId' =>
$availabilityRuleId,
],