Merge branch '2.2' into bugfix/action-csrf-token

This commit is contained in:
Michał Kaczmarek 2026-05-18 18:11:24 +02:00
commit c529271d82

View file

@ -84,6 +84,32 @@ final class CartTest extends JsonApiTestCase
$this->assertResponseCreated('shop/checkout/cart/get_existing_cart_if_customer_has_cart');
}
#[Test]
public function it_does_not_return_existing_cart_when_guest_provides_registered_customer_email(): void
{
$this->setUpDefaultPostHeaders();
$this->loadFixturesFromFiles([
'authentication/shop_user.yaml',
'channel/channel.yaml',
'cart.yaml',
'cart/existing_cart.yaml',
]);
$this->requestPost(
uri: '/api/v2/shop/orders',
body: ['email' => 'shop@example.com'],
);
$this->assertResponseCode($this->client->getResponse(), Response::HTTP_CREATED);
$response = json_decode($this->client->getResponse()->getContent(), true, flags: \JSON_THROW_ON_ERROR);
self::assertNotSame('existingCartToken', $response['tokenValue']);
self::assertNull($response['customer'] ?? null);
self::assertSame([], $response['items']);
}
#[Test]
public function it_gets_an_empty_cart_as_guest(): void
{