Skip to content

Commit 2a546dd

Browse files
committed
MC-17015: [GraphQL] Product Categories query doesn't return all categories where product is visible
- stabilize tests
1 parent 6ab71fd commit 2a546dd

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
use Magento\TestFramework\ObjectManager;
1616
use Magento\TestFramework\TestCase\GraphQlAbstract;
1717

18+
/**
19+
* Test products query output
20+
*/
1821
class ProductViewTest extends GraphQlAbstract
1922
{
2023
/**

dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/ConfigurableProductViewTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
use Magento\TestFramework\ObjectManager;
1616
use Magento\TestFramework\TestCase\GraphQlAbstract;
1717

18+
/**
19+
* Test products query for configurable products
20+
*/
1821
class ConfigurableProductViewTest extends GraphQlAbstract
1922
{
2023
/**
@@ -232,7 +235,6 @@ private function assertBaseFields($product, $actualResponse)
232235
$regularPriceAmount = $priceInfo->getPrice(RegularPrice::PRICE_CODE)->getAmount();
233236
/** @var MetadataPool $metadataPool */
234237
$metadataPool = ObjectManager::getInstance()->get(MetadataPool::class);
235-
// ['product_object_field_name', 'expected_value']
236238
$assertionMap = [
237239
['response_field' => 'attribute_set_id', 'expected_value' => $product->getAttributeSetId()],
238240
['response_field' => 'created_at', 'expected_value' => $product->getCreatedAt()],
@@ -311,7 +313,7 @@ private function assertConfigurableVariants($actualResponse)
311313
/** @var \Magento\Catalog\Model\Product $childProduct */
312314
$childProduct = $productRepository->get($indexValue);
313315

314-
switch( $variantProductId ){
316+
switch ($variantProductId) {
315317
case 10:
316318
$this->assertEmpty(
317319
$actualResponse['variants'][$variantKey]['product']['categories'],
@@ -323,6 +325,7 @@ private function assertConfigurableVariants($actualResponse)
323325
$actualResponse['variants'][$variantKey]['product']['categories'][0],
324326
['id' => 333]
325327
);
328+
break;
326329
}
327330
unset($variantArray['product']['categories']);
328331

dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/product_configurable_with_category_and_weight.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
$productIds = [10, 20];
3939
array_shift($options); //remove the first option which is empty
4040
$visibility = [
41-
10 => Visibility::VISIBILITY_IN_CATALOG,
42-
20 => Visibility::VISIBILITY_NOT_VISIBLE,
41+
10 => Visibility::VISIBILITY_NOT_VISIBLE,
42+
20 => Visibility::VISIBILITY_IN_CATALOG
4343
];
4444

4545
foreach ($options as $option) {

0 commit comments

Comments
 (0)