return $errorCollection;
} private function getSalesChannelContext(bool
$dontReturnDefaultShippingMethod = false
): SalesChannelContext
{ $salesChannel =
new SalesChannelEntity();
$salesChannel->
setId(TestDefaults::SALES_CHANNEL
);
$salesChannel->
setLanguageId(Defaults::LANGUAGE_SYSTEM
);
if ($dontReturnDefaultShippingMethod) { $salesChannel->
setShippingMethodId('not-a-valid-id'
);
} else { $salesChannel->
setShippingMethodId('default-shipping-method-id'
);
} $salesChannelContext =
$this->
createMock(SalesChannelContext::
class);
$salesChannelContext->
method('getSalesChannel'
)->
willReturn($salesChannel);
$salesChannelContext->
method('getContext'
)->
willReturn(Context::
createDefaultContext());
$salesChannelContext->
method('getShippingMethod'
)->
willReturn($this->shippingMethodCollection->
get('original-shipping-method-id'
));
return $salesChannelContext;
}