Skip to content

Commit 9d2c606

Browse files
author
Vitaliy Boyko
committed
graphQl-825: Static fix
1 parent a918fa9 commit 9d2c606

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

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

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ protected function setUp()
3939
{
4040
$this->objectManager = Bootstrap::getObjectManager();
4141
$this->getMaskedQuoteIdByReservedOrderId = $this->objectManager->get(GetMaskedQuoteIdByReservedOrderId::class);
42-
$this->getCustomOptionsValuesForQueryBySku = $this->objectManager->get(GetCustomOptionsValuesForQueryBySku::class);
42+
$this->getCustomOptionsValuesForQueryBySku =
43+
$this->objectManager->get(GetCustomOptionsValuesForQueryBySku::class);
4344
}
4445

4546
/**
@@ -65,7 +66,8 @@ public function testAddDownloadableProductWithOptions()
6566
$response = $this->graphQlMutation($query);
6667
self::assertArrayHasKey('items', $response['addDownloadableProductsToCart']['cart']);
6768
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'];
6971
$assignedOptionsCount = count($customOptionsValues);
7072
for ($counter = 0; $counter < $assignedOptionsCount; $counter++) {
7173
$expectedValues = $this->buildExpectedValuesArray($customOptionsValues[$counter]['value_string']);
@@ -79,9 +81,6 @@ public function testAddDownloadableProductWithOptions()
7981
/**
8082
* @magentoApiDataFixture Magento/Downloadable/_files/product_downloadable_with_custom_options.php
8183
* @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.
8584
*/
8685
public function testAddDownloadableProductWithMissedRequiredOptionsSet()
8786
{
@@ -95,6 +94,11 @@ public function testAddDownloadableProductWithMissedRequiredOptionsSet()
9594

9695
$query = $this->getQuery($maskedQuoteId, $qty, $sku, $customizableOptions, $linkId);
9796

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+
98102
$this->graphQlMutation($query);
99103
}
100104

@@ -148,8 +152,13 @@ private function buildExpectedValuesArray(string $assignedValue) : array
148152
* @param $linkId
149153
* @return string
150154
*/
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 {
153162
$query = <<<MUTATION
154163
mutation {
155164
addDownloadableProductsToCart(

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
use Magento\Catalog\Api\ProductCustomOptionRepositoryInterface;
1111

1212
/**
13-
* Generate an array with test values for customizable options
14-
* based on the option type
13+
* Generate an array with test values for customizable options based on the option type
1514
*/
1615
class GetCustomOptionsValuesForQueryBySku
1716
{

dev/tests/integration/testsuite/Magento/Downloadable/_files/product_downloadable_with_custom_options.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@
8181
$customOptions = [];
8282

8383
/** @var \Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory $customOptionFactory */
84-
$customOptionFactory = Bootstrap::getObjectManager()->get(\Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory::class);
84+
$customOptionFactory = Bootstrap::getObjectManager()
85+
->get(\Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory::class);
8586

8687
foreach ($options as $option) {
8788
/** @var \Magento\Catalog\Api\Data\ProductCustomOptionInterface $customOption */
@@ -94,5 +95,6 @@
9495
$product->setOptions($customOptions);
9596

9697
/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepositoryFactory */
97-
$productRepositoryFactory = Bootstrap::getObjectManager()->create(\Magento\Catalog\Api\ProductRepositoryInterface::class);
98+
$productRepositoryFactory = Bootstrap::getObjectManager()
99+
->create(\Magento\Catalog\Api\ProductRepositoryInterface::class);
98100
$productRepositoryFactory->save($product);

0 commit comments

Comments
 (0)