Skip to content

Commit 05f3458

Browse files
committed
Additional test cases
1 parent 241450e commit 05f3458

File tree

1 file changed

+139
-0
lines changed

1 file changed

+139
-0
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/PlaceOrderTest.php

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,145 @@ public function testPlaceOrderWithNoEmail()
9797
$this->graphQlQuery($query);
9898
}
9999

100+
/**
101+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
102+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/set_guest_email.php
103+
*/
104+
public function testPlaceOrderWithNoItemsInCart()
105+
{
106+
$reservedOrderId = 'test_quote';
107+
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute($reservedOrderId);
108+
$query = $this->getQuery($maskedQuoteId);
109+
110+
self::expectExceptionMessage(
111+
'Unable to place order: A server error stopped your order from being placed. ' .
112+
'Please try to place your order again'
113+
);
114+
$this->graphQlQuery($query);
115+
}
116+
117+
/**
118+
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
119+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
120+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/set_guest_email.php
121+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
122+
*/
123+
public function testPlaceOrderWithNoShippingAddress()
124+
{
125+
$reservedOrderId = 'test_quote';
126+
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute($reservedOrderId);
127+
$query = $this->getQuery($maskedQuoteId);
128+
129+
self::expectExceptionMessage(
130+
'Unable to place order: Some addresses can\'t be used due to the configurations for specific countries'
131+
);
132+
$this->graphQlQuery($query);
133+
}
134+
135+
/**
136+
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
137+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
138+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/set_guest_email.php
139+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
140+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
141+
*/
142+
public function testPlaceOrderWithNoShippingMethod()
143+
{
144+
$reservedOrderId = 'test_quote';
145+
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute($reservedOrderId);
146+
$query = $this->getQuery($maskedQuoteId);
147+
148+
self::expectExceptionMessage(
149+
'Unable to place order: The shipping method is missing. Select the shipping method and try again'
150+
);
151+
$this->graphQlQuery($query);
152+
}
153+
154+
/**
155+
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
156+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/enable_offline_shipping_methods.php
157+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
158+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/set_guest_email.php
159+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
160+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
161+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_flatrate_shipping_method.php
162+
*/
163+
public function testPlaceOrderWithNoBillingAddress()
164+
{
165+
$reservedOrderId = 'test_quote';
166+
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute($reservedOrderId);
167+
$query = $this->getQuery($maskedQuoteId);
168+
169+
self::expectExceptionMessageRegExp(
170+
'/Unable to place order: Please check the billing address information*/'
171+
);
172+
$this->graphQlQuery($query);
173+
}
174+
175+
/**
176+
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
177+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/enable_offline_shipping_methods.php
178+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
179+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/set_guest_email.php
180+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
181+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
182+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_billing_address.php
183+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_flatrate_shipping_method.php
184+
*/
185+
public function testPlaceOrderWithNoPaymentMethod()
186+
{
187+
$reservedOrderId = 'test_quote';
188+
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute($reservedOrderId);
189+
$query = $this->getQuery($maskedQuoteId);
190+
191+
self::expectExceptionMessage('Unable to place order: Enter a valid payment method and try again');
192+
$this->graphQlQuery($query);
193+
}
194+
195+
/**
196+
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
197+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/enable_offline_shipping_methods.php
198+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
199+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/set_guest_email.php
200+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
201+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
202+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_billing_address.php
203+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_flatrate_shipping_method.php
204+
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/set_simple_product_out_of_stock.php
205+
*/
206+
public function testPlaceOrderWithOutOfStockProduct()
207+
{
208+
$reservedOrderId = 'test_quote';
209+
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute($reservedOrderId);
210+
$query = $this->getQuery($maskedQuoteId);
211+
212+
self::expectExceptionMessage('Unable to place order: Some of the products are out of stock');
213+
$this->graphQlQuery($query);
214+
}
215+
216+
/**
217+
* _security
218+
* @magentoApiDataFixture Magento/Customer/_files/three_customers.php
219+
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
220+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/enable_offline_shipping_methods.php
221+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/enable_offline_payment_methods.php
222+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
223+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
224+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
225+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_billing_address.php
226+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_flatrate_shipping_method.php
227+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_checkmo_payment_method.php
228+
*/
229+
public function testPlaceOrderOfAnotherCustomerCart()
230+
{
231+
$reservedOrderId = 'test_quote';
232+
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute($reservedOrderId);
233+
$query = $this->getQuery($maskedQuoteId);
234+
235+
self::expectExceptionMessageRegExp('/The current user cannot perform operations on cart*/');
236+
$this->graphQlQuery($query);
237+
}
238+
100239
/**
101240
* @param string $maskedQuoteId
102241
* @return string

0 commit comments

Comments
 (0)