mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
[Checkout][Api] Remove re- checkout actions
This commit is contained in:
parent
1aa770a54b
commit
cb6b8f1179
6 changed files with 5 additions and 245 deletions
|
|
@ -27,7 +27,7 @@ Feature: Prices get updated when exchange rate changes during the whole checkout
|
|||
And I specified the shipping address as "Ankh Morpork", "Frost Alley", "90210", "United States" for "Jon Snow"
|
||||
Then the subtotal of "The Pug Mug" item should be "£50.00"
|
||||
|
||||
@ui @javascript
|
||||
@ui
|
||||
Scenario: Prices get updated on readdressing
|
||||
Given I specified the shipping address as "Ankh Morpork", "Frost Alley", "90210", "United States" for "Jon Snow"
|
||||
When the exchange rate for currency "GBP" was changed to 3.00
|
||||
|
|
@ -42,7 +42,7 @@ Feature: Prices get updated when exchange rate changes during the whole checkout
|
|||
And I complete the shipping step
|
||||
Then the subtotal of "The Pug Mug" item should be "£20.00"
|
||||
|
||||
@ui @javascript
|
||||
@ui
|
||||
Scenario: Prices get updated on re-selecting shipping step
|
||||
Given I specified the shipping address as "Ankh Morpork", "Frost Alley", "90210", "United States" for "Jon Snow"
|
||||
And I have selected "Pigeon Mail" shipping method
|
||||
|
|
@ -62,7 +62,7 @@ Feature: Prices get updated when exchange rate changes during the whole checkout
|
|||
Then the "The Pug Mug" product should have unit price "£20.00"
|
||||
And my order shipping should be "£10.00"
|
||||
|
||||
@ui @javascript
|
||||
@ui
|
||||
Scenario: Prices get updated on re-selecting payment method step
|
||||
Given I specified the shipping address as "Ankh Morpork", "Frost Alley", "90210", "United States" for "Jon Snow"
|
||||
And I proceed order with "Pigeon Mail" shipping method and "Offline" payment
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ Feature: Reapplying promotion on cart change
|
|||
And there should be no shipping fee
|
||||
And there should be no discount
|
||||
|
||||
@ui @javascript
|
||||
@ui
|
||||
Scenario: Receiving discount on shipping after shipping method change
|
||||
Given the store has "DHL" shipping method with "$10.00" fee
|
||||
And the store has "FedEx" shipping method with "$30.00" fee
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Feature: Apply correct shipping fee on order
|
|||
Then my cart total should be "$110.00"
|
||||
And my cart shipping total should be "$10.00"
|
||||
|
||||
@ui @javascript
|
||||
@ui
|
||||
Scenario: Changing shipping fee after shipping method change
|
||||
Given I have product "PHP T-Shirt" in the cart
|
||||
And I chose "DHL" shipping method
|
||||
|
|
|
|||
|
|
@ -1,77 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Tests\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* @author Mateusz Zalewski <mateusz.zalewski@lakion.com>
|
||||
*/
|
||||
final class CheckoutReaddressingApiTest extends CheckoutApiTestCase
|
||||
{
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_denies_order_readdressing_for_non_authenticated_user()
|
||||
{
|
||||
$this->client->request('PUT', '/api/checkouts/readdress/1');
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
$this->assertResponse($response, 'authentication/access_denied_response', Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_does_not_allow_to_readdress_unexisting_order()
|
||||
{
|
||||
$this->loadFixturesFromFile('authentication/api_administrator.yml');
|
||||
|
||||
$this->client->request('PUT', '/api/checkouts/readdress/1', [], [], static::$authorizedHeaderWithContentType);
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
$this->assertResponseCode($response, Response::HTTP_NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_does_not_allow_to_readdress_order_that_is_not_addressed()
|
||||
{
|
||||
$this->loadFixturesFromFile('authentication/api_administrator.yml');
|
||||
$checkoutData = $this->loadFixturesFromFile('resources/checkout.yml');
|
||||
|
||||
$url = sprintf('/api/checkouts/readdress/%d', $checkoutData['order1']->getId());
|
||||
$this->client->request('PUT', $url, [], [], static::$authorizedHeaderWithContentType);
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
$this->assertResponseCode($response, Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_allows_to_readdress_addressed_order()
|
||||
{
|
||||
$this->loadFixturesFromFile('authentication/api_administrator.yml');
|
||||
$checkoutData = $this->loadFixturesFromFile('resources/checkout.yml');
|
||||
|
||||
$orderId = $checkoutData['order1']->getId();
|
||||
$this->addressOrder($orderId);
|
||||
|
||||
$url = sprintf('/api/checkouts/readdress/%d', $orderId);
|
||||
$this->client->request('PUT', $url, [], [], static::$authorizedHeaderWithContentType);
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
$this->assertResponse($response, 'checkout/readdressing_response', Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Tests\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* @author Mateusz Zalewski <mateusz.zalewski@lakion.com>
|
||||
*/
|
||||
final class CheckoutPaymentShippingApiTest extends CheckoutApiTestCase
|
||||
{
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_denies_reselecting_order_payment_for_non_authenticated_user()
|
||||
{
|
||||
$this->client->request('PUT', '/api/checkouts/reselect-payment/1');
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
$this->assertResponse($response, 'authentication/access_denied_response', Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_does_not_allow_to_reselect_paymeny_of_unexisting_order()
|
||||
{
|
||||
$this->loadFixturesFromFile('authentication/api_administrator.yml');
|
||||
|
||||
$this->client->request('PUT', '/api/checkouts/reselect-payment/1', [], [], static::$authorizedHeaderWithContentType);
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
$this->assertResponseCode($response, Response::HTTP_NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_does_not_allow_to_reselect_payment_of_order_that_has_no_payment_method_selected()
|
||||
{
|
||||
$this->loadFixturesFromFile('authentication/api_administrator.yml');
|
||||
$checkoutData = $this->loadFixturesFromFile('resources/checkout.yml');
|
||||
|
||||
$orderId = $checkoutData['order1']->getId();
|
||||
$this->addressOrder($orderId);
|
||||
|
||||
$url = sprintf('/api/checkouts/reselect-payment/%d', $orderId);
|
||||
$this->client->request('PUT', $url, [], [], static::$authorizedHeaderWithContentType);
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
$this->assertResponseCode($response, Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_allows_to_reselect_paymeny_of_order_with_paymeny_method_selected()
|
||||
{
|
||||
$this->loadFixturesFromFile('authentication/api_administrator.yml');
|
||||
$checkoutData = $this->loadFixturesFromFile('resources/checkout.yml');
|
||||
|
||||
$orderId = $checkoutData['order1']->getId();
|
||||
$this->addressOrder($orderId);
|
||||
$this->selectOrderShippingMethod($orderId, $checkoutData['ups']->getId());
|
||||
$this->selectOrderPaymentMethod($orderId, $checkoutData['cash_on_delivery']->getId());
|
||||
|
||||
$url = sprintf('/api/checkouts/reselect-payment/%d', $orderId);
|
||||
$this->client->request('PUT', $url, [], [], static::$authorizedHeaderWithContentType);
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
$this->assertResponse($response, 'checkout/reselect_payment_response', Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Tests\Controller;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* @author Mateusz Zalewski <mateusz.zalewski@lakion.com>
|
||||
*/
|
||||
final class CheckoutReselectingShippingApiTest extends CheckoutApiTestCase
|
||||
{
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_denies_reselecting_order_shipping_for_non_authenticated_user()
|
||||
{
|
||||
$this->client->request('PUT', '/api/checkouts/reselect-shipping/1');
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
$this->assertResponse($response, 'authentication/access_denied_response', Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_does_not_allow_to_reselect_shipping_of_unexisting_order()
|
||||
{
|
||||
$this->loadFixturesFromFile('authentication/api_administrator.yml');
|
||||
|
||||
$this->client->request('PUT', '/api/checkouts/reselect-shipping/1', [], [], static::$authorizedHeaderWithContentType);
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
$this->assertResponseCode($response, Response::HTTP_NOT_FOUND);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_does_not_allow_to_reselect_shipping_of_order_that_has_no_shipment_method_selected()
|
||||
{
|
||||
$this->loadFixturesFromFile('authentication/api_administrator.yml');
|
||||
$checkoutData = $this->loadFixturesFromFile('resources/checkout.yml');
|
||||
|
||||
$orderId = $checkoutData['order1']->getId();
|
||||
$this->addressOrder($orderId);
|
||||
|
||||
$url = sprintf('/api/checkouts/reselect-shipping/%d', $orderId);
|
||||
$this->client->request('PUT', $url, [], [], static::$authorizedHeaderWithContentType);
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
$this->assertResponseCode($response, Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_allows_to_reselect_shipping_of_order_with_shipment_method_selected()
|
||||
{
|
||||
$this->loadFixturesFromFile('authentication/api_administrator.yml');
|
||||
$checkoutData = $this->loadFixturesFromFile('resources/checkout.yml');
|
||||
|
||||
$orderId = $checkoutData['order1']->getId();
|
||||
$this->addressOrder($orderId);
|
||||
$this->selectOrderShippingMethod($orderId, $checkoutData['ups']->getId());
|
||||
|
||||
$url = sprintf('/api/checkouts/reselect-shipping/%d', $orderId);
|
||||
$this->client->request('PUT', $url, [], [], static::$authorizedHeaderWithContentType);
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
$this->assertResponse($response, 'checkout/reselect_shipping_response', Response::HTTP_OK);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue