mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-05 20:57:12 +00:00
Merge branch '2.2' into bugfix/action-csrf-token
This commit is contained in:
commit
c529271d82
1 changed files with 26 additions and 0 deletions
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue