Skip to content

Commit e1fb9de

Browse files
ENGCOM-7020: magento/magento2#: Test Coverage. API functional tests. removeItemFromCart #26563
- Merge Pull Request #26563 from atwixfirster/magento2:api-functional-graphql-removeItemFromCart - Merged commits: 1. d64082f 2. c3a9acd 3. b37b091
2 parents cac512f + b37b091 commit e1fb9de

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/RemoveItemFromCartTest.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,40 @@ public function testRemoveItemFromAnotherCustomerCart()
155155
$this->graphQlMutation($query, [], '', $this->getHeaderMap('[email protected]'));
156156
}
157157

158+
/**
159+
* @magentoApiDataFixture Magento/Customer/_files/customer.php
160+
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
161+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
162+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
163+
*/
164+
public function testRemoveItemWithEmptyCartId()
165+
{
166+
$cartId = "";
167+
$cartItemId = $this->getQuoteItemIdByReservedQuoteIdAndSku->execute('test_quote', 'simple_product');
168+
169+
$this->expectExceptionMessage("Required parameter \"cart_id\" is missing.");
170+
171+
$query = $this->getQuery($cartId, $cartItemId);
172+
$this->graphQlMutation($query, [], '', $this->getHeaderMap());
173+
}
174+
175+
/**
176+
* @magentoApiDataFixture Magento/Customer/_files/customer.php
177+
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
178+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
179+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
180+
*/
181+
public function testRemoveItemWithZeroCartItemId()
182+
{
183+
$cartId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
184+
$cartItemId = 0;
185+
186+
$this->expectExceptionMessage("Required parameter \"cart_item_id\" is missing.");
187+
188+
$query = $this->getQuery($cartId, $cartItemId);
189+
$this->graphQlMutation($query, [], '', $this->getHeaderMap());
190+
}
191+
158192
/**
159193
* @param string $maskedQuoteId
160194
* @param int $itemId

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,38 @@ public function testRemoveItemFromCustomerCart()
119119
$this->graphQlMutation($query);
120120
}
121121

122+
/**
123+
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
124+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
125+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
126+
*/
127+
public function testRemoveItemWithEmptyCartId()
128+
{
129+
$cartId = "";
130+
$cartItemId = $this->getQuoteItemIdByReservedQuoteIdAndSku->execute('test_quote', 'simple_product');
131+
132+
$this->expectExceptionMessage("Required parameter \"cart_id\" is missing.");
133+
134+
$query = $this->getQuery($cartId, $cartItemId);
135+
$this->graphQlMutation($query);
136+
}
137+
138+
/**
139+
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
140+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
141+
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
142+
*/
143+
public function testRemoveItemWithZeroCartItemId()
144+
{
145+
$cartId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
146+
$cartItemId = 0;
147+
148+
$this->expectExceptionMessage("Required parameter \"cart_item_id\" is missing.");
149+
150+
$query = $this->getQuery($cartId, $cartItemId);
151+
$this->graphQlMutation($query);
152+
}
153+
122154
/**
123155
* @param string $maskedQuoteId
124156
* @param int $itemId

0 commit comments

Comments
 (0)