[Unit] Adjust shop tests

This commit is contained in:
Rafikooo 2025-11-29 01:10:36 +01:00
parent 627ca8d361
commit c4e372c49f
No known key found for this signature in database
GPG key ID: 4A26D8327BC2442B
8 changed files with 5 additions and 22 deletions

View file

@ -252,8 +252,7 @@ final class AddressesTest extends JsonApiTestCase
], \JSON_THROW_ON_ERROR), ], \JSON_THROW_ON_ERROR),
); );
$this->assertResponseStatusCodeSame(Response::HTTP_UNPROCESSABLE_ENTITY); $this->assertResponseViolations([
$this->assertJsonResponseViolations($this->client->getResponse(), [
[ [
'propertyPath' => 'countryCode', 'propertyPath' => 'countryCode',
'message' => 'This value is not a valid country.', 'message' => 'This value is not a valid country.',

View file

@ -447,7 +447,6 @@ final class CartTest extends JsonApiTestCase
); );
$this->assertResponseViolations( $this->assertResponseViolations(
$this->client->getResponse(),
[ [
['propertyPath' => '', 'message' => 'Email can be changed only for guest customers. Once the customer logs in and the cart is assigned, the email can\'t be changed.'], ['propertyPath' => '', 'message' => 'Email can be changed only for guest customers. Once the customer logs in and the cart is assigned, the email can\'t be changed.'],
], ],
@ -471,7 +470,6 @@ final class CartTest extends JsonApiTestCase
); );
$this->assertResponseViolations( $this->assertResponseViolations(
$this->client->getResponse(),
[ [
['propertyPath' => '', 'message' => 'An empty order cannot be processed.'], ['propertyPath' => '', 'message' => 'An empty order cannot be processed.'],
], ],
@ -510,7 +508,6 @@ final class CartTest extends JsonApiTestCase
); );
$this->assertResponseViolations( $this->assertResponseViolations(
$this->client->getResponse(),
[ [
['propertyPath' => '', 'message' => 'Please provide a billing address.'], ['propertyPath' => '', 'message' => 'Please provide a billing address.'],
], ],
@ -549,7 +546,6 @@ final class CartTest extends JsonApiTestCase
); );
$this->assertResponseViolations( $this->assertResponseViolations(
$this->client->getResponse(),
[ [
['propertyPath' => '', 'message' => 'Please provide a shipping address.'], ['propertyPath' => '', 'message' => 'Please provide a shipping address.'],
], ],
@ -582,7 +578,6 @@ final class CartTest extends JsonApiTestCase
); );
$this->assertResponseViolations( $this->assertResponseViolations(
$this->client->getResponse(),
[ [
['propertyPath' => '', 'message' => 'The country invalid-code does not exist.'], ['propertyPath' => '', 'message' => 'The country invalid-code does not exist.'],
['propertyPath' => '', 'message' => 'The address without country cannot exist'], ['propertyPath' => '', 'message' => 'The address without country cannot exist'],

View file

@ -47,7 +47,6 @@ final class CompletionTest extends JsonApiTestCase
); );
$this->assertResponseViolations( $this->assertResponseViolations(
$this->client->getResponse(),
[ [
['propertyPath' => '', 'message' => 'Cannot complete as order is in a wrong state. Current: cart. Possible transitions: address.'], ['propertyPath' => '', 'message' => 'Cannot complete as order is in a wrong state. Current: cart. Possible transitions: address.'],
], ],
@ -75,7 +74,6 @@ final class CompletionTest extends JsonApiTestCase
); );
$this->assertResponseViolations( $this->assertResponseViolations(
$this->client->getResponse(),
[ [
['propertyPath' => '', 'message' => 'Cannot complete as order is in a wrong state. Current: addressed. Possible transitions: address, skip_shipping, select_shipping.'], ['propertyPath' => '', 'message' => 'Cannot complete as order is in a wrong state. Current: addressed. Possible transitions: address, skip_shipping, select_shipping.'],
], ],
@ -105,7 +103,6 @@ final class CompletionTest extends JsonApiTestCase
); );
$this->assertResponseViolations( $this->assertResponseViolations(
$this->client->getResponse(),
[ [
['propertyPath' => '', 'message' => 'Cannot complete as order is in a wrong state. Current: shipping_selected. Possible transitions: address, select_shipping, skip_payment, select_payment.'], ['propertyPath' => '', 'message' => 'Cannot complete as order is in a wrong state. Current: shipping_selected. Possible transitions: address, select_shipping, skip_payment, select_payment.'],
], ],
@ -134,7 +131,6 @@ final class CompletionTest extends JsonApiTestCase
); );
$this->assertResponseViolations( $this->assertResponseViolations(
$this->client->getResponse(),
[ [
['propertyPath' => '', 'message' => 'Cannot complete as order is in a wrong state. Current: shipping_skipped. Possible transitions: address, skip_payment, select_payment.'], ['propertyPath' => '', 'message' => 'Cannot complete as order is in a wrong state. Current: shipping_skipped. Possible transitions: address, skip_payment, select_payment.'],
], ],

View file

@ -287,7 +287,6 @@ final class PaymentMethodTest extends JsonApiTestCase
); );
$this->assertResponseViolations( $this->assertResponseViolations(
$this->client->getResponse(),
[ [
['propertyPath' => '', 'message' => 'The payment method with invalid code does not exist.'], ['propertyPath' => '', 'message' => 'The payment method with invalid code does not exist.'],
], ],

View file

@ -147,7 +147,6 @@ final class ShippingMethodTest extends JsonApiTestCase
); );
$this->assertResponseViolations( $this->assertResponseViolations(
$this->client->getResponse(),
[ [
['propertyPath' => '', 'message' => 'The shipping method with invalid code does not exist.'], ['propertyPath' => '', 'message' => 'The shipping method with invalid code does not exist.'],
], ],

View file

@ -51,7 +51,7 @@ final class OrdersTest extends JsonApiTestCase
$this->placeOrder('nAWw2jewpB', 'oliver@doe.com'); $this->placeOrder('nAWw2jewpB', 'oliver@doe.com');
$this->placeOrder('nAWw2jewpC', 'dave@doe.com'); $this->placeOrder('nAWw2jewpC', 'dave@doe.com');
$this->pickUpCart('nAWw2jewpD'); $this->pickUpCart('nAWw2jewpD');
$this->updateCartWithAddressAndCouponCode('nAWw2jewpD', 'oliver@doe.com'); $this->updateCartWithAddress('nAWw2jewpD', 'oliver@doe.com');
$this->pickUpCart('nAWw2jewpE'); $this->pickUpCart('nAWw2jewpE');
$this->requestGet( $this->requestGet(
@ -461,7 +461,6 @@ final class OrdersTest extends JsonApiTestCase
); );
$this->assertResponseViolations( $this->assertResponseViolations(
$this->client->getResponse(),
[ [
['propertyPath' => '', 'message' => 'You cannot change the payment method for a cancelled order.'], ['propertyPath' => '', 'message' => 'You cannot change the payment method for a cancelled order.'],
], ],

View file

@ -185,12 +185,9 @@ final class PaymentRequestsTest extends JsonApiTestCase
], \JSON_THROW_ON_ERROR), ], \JSON_THROW_ON_ERROR),
); );
$this->assertResponseViolations( $this->assertResponseContainsViolations([
$this->client->getResponse(), ['propertyPath' => '', 'message' => sprintf('The payment request (method code: %s and payment id: %d) has no handler. Please choose another payment method.', $payment->getMethod()->getCode(), $payment->getId())],
[ ]);
['propertyPath' => '', 'message' => sprintf('The payment request (method code: %s and payment id: %d) has no handler. Please choose another payment method.', $payment->getMethod()->getCode(), $payment->getId())],
],
);
} }
/** /**

View file

@ -135,7 +135,6 @@ final class ProductReviewsTest extends JsonApiTestCase
); );
$this->assertResponseViolations( $this->assertResponseViolations(
$this->client->getResponse(),
[ [
[ [
'propertyPath' => 'email', 'propertyPath' => 'email',