Skip to content

Commit 30589d7

Browse files
committed
ACP2E-3505: Disabled product still appears in related, upsell, crosssell items in grpahQL query
1 parent 3643185 commit 30589d7

File tree

1 file changed

+2
-76
lines changed

1 file changed

+2
-76
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/RelatedProduct/GetRelatedProductsTest.php

Lines changed: 2 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright 2019 Adobe
4-
* ll Rights Reserved.
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
55
*/
66
declare(strict_types=1);
77

@@ -83,80 +83,6 @@ public function testQueryDisableRelatedProduct()
8383
self::assertCount(0, $relatedProducts);
8484
}
8585

86-
/**
87-
* @magentoApiDataFixture Magento/Catalog/_files/products_related_disabled.php
88-
* @magentoConfigFixture default/cataloginventory/options/show_out_of_stock 1
89-
*/
90-
public function testQueryDisableRelatedProductWithShowOutOfStock()
91-
{
92-
$productSku = 'simple_with_cross';
93-
94-
$query = <<<QUERY
95-
{
96-
products(filter: {sku: {eq: "{$productSku}"}})
97-
{
98-
items {
99-
related_products
100-
{
101-
sku
102-
name
103-
url_key
104-
}
105-
}
106-
}
107-
}
108-
QUERY;
109-
$response = $this->graphQlQuery($query);
110-
111-
self::assertArrayHasKey('products', $response);
112-
self::assertArrayHasKey('items', $response['products']);
113-
self::assertCount(1, $response['products']['items']);
114-
self::assertArrayHasKey(0, $response['products']['items']);
115-
self::assertArrayHasKey('related_products', $response['products']['items'][0]);
116-
$relatedProducts = $response['products']['items'][0]['related_products'];
117-
self::assertCount(0, $relatedProducts);
118-
}
119-
120-
/**
121-
* @magentoApiDataFixture Magento/Catalog/_files/products_crosssell.php
122-
*/
123-
public function testQueryCrossSellProducts()
124-
{
125-
$productSku = 'simple_with_cross';
126-
127-
$query = <<<QUERY
128-
{
129-
products(filter: {sku: {eq: "{$productSku}"}})
130-
{
131-
items {
132-
crosssell_products
133-
{
134-
sku
135-
name
136-
url_key
137-
}
138-
}
139-
}
140-
}
141-
QUERY;
142-
$response = $this->graphQlQuery($query);
143-
144-
self::assertArrayHasKey('products', $response);
145-
self::assertArrayHasKey('items', $response['products']);
146-
self::assertCount(1, $response['products']['items']);
147-
self::assertArrayHasKey(0, $response['products']['items']);
148-
self::assertArrayHasKey('crosssell_products', $response['products']['items'][0]);
149-
$crossSellProducts = $response['products']['items'][0]['crosssell_products'];
150-
self::assertCount(1, $crossSellProducts);
151-
$crossSellProduct = $crossSellProducts[0];
152-
self::assertArrayHasKey('sku', $crossSellProduct);
153-
self::assertArrayHasKey('name', $crossSellProduct);
154-
self::assertArrayHasKey('url_key', $crossSellProduct);
155-
self::assertEquals($crossSellProduct['sku'], 'simple');
156-
self::assertEquals($crossSellProduct['name'], 'Simple Cross Sell');
157-
self::assertEquals($crossSellProduct['url_key'], 'simple-cross-sell');
158-
}
159-
16086
/**
16187
* @magentoApiDataFixture Magento/Catalog/_files/products_upsell.php
16288
*/

0 commit comments

Comments
 (0)