Skip to content

Commit 1521ac2

Browse files
committed
API-functional test for adding product with wrong SKU
1 parent 11e23d6 commit 1521ac2

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,26 @@ public function testAddSimpleProductWithOptions()
9797
}
9898
}
9999

100+
/**
101+
* @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
102+
* @group wip
103+
*/
104+
public function testAddProductWithWrongSku()
105+
{
106+
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1');
107+
$sku = 'non-existent';
108+
109+
$query = $this->getQuery($maskedQuoteId, 1, $sku, '');
110+
$response = $this->graphQlMutation($query);
111+
112+
self::assertArrayHasKey('userInputErrors', $response['addProductsToCart']);
113+
self::assertCount(1, $response['addProductsToCart']['userInputErrors']);
114+
self::assertEquals(
115+
'Could not find a product with SKU "' . $sku .'"',
116+
$response['addProductsToCart']['userInputErrors'][0]['message']
117+
);
118+
}
119+
100120
/**
101121
* Returns GraphQl query string
102122
*

0 commit comments

Comments
 (0)