$newShippingAddress->
setLastName(''
);
$customer->
setActiveShippingAddress($newShippingAddress);
$cartErrors =
$this->
getPageLoader()->
load($request,
$context)->
getCart()->
getErrors();
static::
assertCount(2,
$cartErrors);
$errors =
$cartErrors->
getElements();
static::
assertArrayHasKey('billing-address-invalid',
$errors);
static::
assertArrayHasKey('shipping-address-invalid',
$errors);
/** @var AddressValidationError $billingAddressViolation */
$billingAddressViolation =
$errors['billing-address-invalid'
];
$violation =
$billingAddressViolation->
getViolations()->
get(0
);
static::
assertSame('/firstName',
$violation->
getPropertyPath());
/** @var AddressValidationError $shippingAddressViolation */
$shippingAddressViolation =
$errors['shipping-address-invalid'
];
$violation =
$shippingAddressViolation->
getViolations()->
get(0
);
static::
assertSame('/lastName',
$violation->
getPropertyPath());
} protected function getPageLoader(): CheckoutConfirmPageLoader
{ return $this->
getContainer()->
get(CheckoutConfirmPageLoader::
class);
}