Skip to content

Commit b115f1c

Browse files
committed
GraphQL-474: Cannot return null for non-nullable field SelectedCustomizableOptionValue.sort_order and Call to a member function getPriceType() on null
1 parent 1315577 commit b115f1c

File tree

1 file changed

+0
-83
lines changed

1 file changed

+0
-83
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/AddProductToCartTest.php

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -46,89 +46,6 @@ public function testAddProductIfQuantityIsNotAvailable()
4646
$this->graphQlMutation($query);
4747
}
4848

49-
/**
50-
* @magentoApiDataFixture Magento/Catalog/_files/product_simple_with_custom_options.php
51-
* @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
52-
* @expectedException \Exception
53-
* @expectedExceptionMessage The product's required option(s) weren't entered. Make sure the options are entered and try again.
54-
*/
55-
public function testAddProductWithoutRequiredCustomOptions()
56-
{
57-
$sku = 'simple_with_custom_options';
58-
$qty = 1;
59-
60-
$maskedQuoteId = $this->getMaskedQuoteId();
61-
$query = $this->getAddSimpleProductQuery($maskedQuoteId, $sku, $qty);
62-
$this->graphQlQuery($query);
63-
}
64-
65-
/**
66-
* @magentoApiDataFixture Magento/Catalog/_files/product_simple_with_custom_options.php
67-
* @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
68-
*/
69-
public function testAddProductWithRequiredCustomOptions()
70-
{
71-
$sku = 'simple_with_custom_options';
72-
$qty = 1;
73-
$productCustomOptions = Bootstrap::getObjectManager()
74-
->get(\Magento\Catalog\Api\ProductCustomOptionRepositoryInterface::class)
75-
->getList($sku);
76-
$customizableOptions = '';
77-
foreach ($productCustomOptions as $option) {
78-
$value = $option->getValues() ?
79-
'[' . key($option->getValues()) . ']' :
80-
'Test';
81-
$customizableOptions .= ' {
82-
id: ' . $option->getId() . '
83-
value: "' . $value . '"
84-
}';
85-
}
86-
87-
$maskedQuoteId = $this->getMaskedQuoteId();
88-
$query = <<<QUERY
89-
mutation {
90-
addSimpleProductsToCart(
91-
input: {
92-
cart_id: "{$maskedQuoteId}"
93-
cartItems: {
94-
data: {
95-
qty: {$qty}
96-
sku: "{$sku}"
97-
}
98-
customizable_options: [
99-
{$customizableOptions}
100-
]
101-
}
102-
}
103-
)
104-
{
105-
cart {
106-
items {
107-
product {
108-
sku
109-
}
110-
... on SimpleCartItem {
111-
customizable_options {
112-
id
113-
is_required
114-
sort_order
115-
}
116-
}
117-
}
118-
}
119-
}
120-
}
121-
QUERY;
122-
$response = $this->graphQlQuery($query);
123-
self::assertArrayHasKey('cart', $response['addSimpleProductsToCart']);
124-
125-
self::assertEquals($sku, $response['addSimpleProductsToCart']['cart']['items'][0]['product']['sku']);
126-
self::assertEquals(
127-
1,
128-
$response['addSimpleProductsToCart']['cart']['items'][0]['customizable_options'][0]['is_required']
129-
);
130-
}
131-
13249
/**
13350
* @magentoApiDataFixture Magento/Catalog/_files/products.php
13451
* @magentoApiDataFixture Magento/Checkout/_files/active_quote.php

0 commit comments

Comments
 (0)