@@ -46,89 +46,6 @@ public function testAddProductIfQuantityIsNotAvailable()
46
46
$ this ->graphQlMutation ($ query );
47
47
}
48
48
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
-
132
49
/**
133
50
* @magentoApiDataFixture Magento/Catalog/_files/products.php
134
51
* @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
0 commit comments