mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
Merge branch '1.12' into 1.13
* 1.12: [Orders][API] Change cart item delete HTTP response code to 204
This commit is contained in:
commit
e1a08fa3d7
2 changed files with 27 additions and 1 deletions
|
|
@ -34,6 +34,6 @@ final class DeleteOrderItemAction
|
|||
|
||||
$this->commandBus->dispatch($command);
|
||||
|
||||
return new JsonResponse();
|
||||
return new JsonResponse(status: Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -393,4 +393,30 @@ final class OrdersTest extends JsonApiTestCase
|
|||
|
||||
$this->assertResponse($response, 'shop/updated_billing_address_on_order_response', Response::HTTP_OK);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_removes_item_from_the_cart(): void
|
||||
{
|
||||
$this->loadFixturesFromFiles(['channel.yaml', 'cart.yaml']);
|
||||
|
||||
$tokenValue = 'nAWw2jewpA';
|
||||
|
||||
/** @var MessageBusInterface $commandBus */
|
||||
$commandBus = self::getContainer()->get('sylius.command_bus');
|
||||
|
||||
$pickupCartCommand = new PickupCart($tokenValue);
|
||||
$pickupCartCommand->setChannelCode('WEB');
|
||||
$commandBus->dispatch($pickupCartCommand);
|
||||
|
||||
$addItemToCartCommand = new AddItemToCart('MUG_BLUE', 3);
|
||||
$addItemToCartCommand->setOrderTokenValue($tokenValue);
|
||||
$commandBus->dispatch($addItemToCartCommand);
|
||||
|
||||
$this->client->request('GET', sprintf('/api/v2/shop/orders/%s', $tokenValue));
|
||||
$itemId = json_decode($this->client->getResponse()->getContent(), true)['items'][0]['id'];
|
||||
|
||||
$this->client->request('DELETE', sprintf('/api/v2/shop/orders/%s/items/%s', $tokenValue, $itemId));
|
||||
|
||||
$this->assertResponseCode($this->client->getResponse(), Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue