@@ -39,7 +39,8 @@ protected function setUp()
39
39
{
40
40
$ this ->objectManager = Bootstrap::getObjectManager ();
41
41
$ this ->getMaskedQuoteIdByReservedOrderId = $ this ->objectManager ->get (GetMaskedQuoteIdByReservedOrderId::class);
42
- $ this ->getCustomOptionsValuesForQueryBySku = $ this ->objectManager ->get (GetCustomOptionsValuesForQueryBySku::class);
42
+ $ this ->getCustomOptionsValuesForQueryBySku =
43
+ $ this ->objectManager ->get (GetCustomOptionsValuesForQueryBySku::class);
43
44
}
44
45
45
46
/**
@@ -65,7 +66,8 @@ public function testAddDownloadableProductWithOptions()
65
66
$ response = $ this ->graphQlMutation ($ query );
66
67
self ::assertArrayHasKey ('items ' , $ response ['addDownloadableProductsToCart ' ]['cart ' ]);
67
68
self ::assertCount ($ qty , $ response ['addDownloadableProductsToCart ' ]['cart ' ]);
68
- $ customizableOptionsOutput = $ response ['addDownloadableProductsToCart ' ]['cart ' ]['items ' ][0 ]['customizable_options ' ];
69
+ $ customizableOptionsOutput =
70
+ $ response ['addDownloadableProductsToCart ' ]['cart ' ]['items ' ][0 ]['customizable_options ' ];
69
71
$ assignedOptionsCount = count ($ customOptionsValues );
70
72
for ($ counter = 0 ; $ counter < $ assignedOptionsCount ; $ counter ++) {
71
73
$ expectedValues = $ this ->buildExpectedValuesArray ($ customOptionsValues [$ counter ]['value_string ' ]);
@@ -79,9 +81,6 @@ public function testAddDownloadableProductWithOptions()
79
81
/**
80
82
* @magentoApiDataFixture Magento/Downloadable/_files/product_downloadable_with_custom_options.php
81
83
* @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
82
- *
83
- * @expectedException \Exception
84
- * @expectedExceptionMessage The product's required option(s) weren't entered. Make sure the options are entered and try again.
85
84
*/
86
85
public function testAddDownloadableProductWithMissedRequiredOptionsSet ()
87
86
{
@@ -95,6 +94,11 @@ public function testAddDownloadableProductWithMissedRequiredOptionsSet()
95
94
96
95
$ query = $ this ->getQuery ($ maskedQuoteId , $ qty , $ sku , $ customizableOptions , $ linkId );
97
96
97
+ $ this ->expectException (\Exception::class);
98
+ $ this ->expectExceptionMessage (
99
+ 'The product \'s required option(s) weren \'t entered. Make sure the options are entered and try again. '
100
+ );
101
+
98
102
$ this ->graphQlMutation ($ query );
99
103
}
100
104
@@ -148,8 +152,13 @@ private function buildExpectedValuesArray(string $assignedValue) : array
148
152
* @param $linkId
149
153
* @return string
150
154
*/
151
- private function getQuery (string $ maskedQuoteId , int $ qty , string $ sku , string $ customizableOptions , $ linkId ): string
152
- {
155
+ private function getQuery (
156
+ string $ maskedQuoteId ,
157
+ int $ qty ,
158
+ string $ sku ,
159
+ string $ customizableOptions ,
160
+ $ linkId
161
+ ): string {
153
162
$ query = <<<MUTATION
154
163
mutation {
155
164
addDownloadableProductsToCart(
0 commit comments