Skip to content

Commit e696967

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

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,46 @@ public function testQueryDisableRelatedProduct()
8383
self::assertCount(0, $relatedProducts);
8484
}
8585

86+
/**
87+
* @magentoApiDataFixture Magento/Catalog/_files/products_crosssell.php
88+
*/
89+
public function testQueryCrossSellProducts()
90+
{
91+
$productSku = 'simple_with_cross';
92+
93+
$query = <<<QUERY
94+
{
95+
products(filter: {sku: {eq: "{$productSku}"}})
96+
{
97+
items {
98+
crosssell_products
99+
{
100+
sku
101+
name
102+
url_key
103+
}
104+
}
105+
}
106+
}
107+
QUERY;
108+
$response = $this->graphQlQuery($query);
109+
110+
self::assertArrayHasKey('products', $response);
111+
self::assertArrayHasKey('items', $response['products']);
112+
self::assertCount(1, $response['products']['items']);
113+
self::assertArrayHasKey(0, $response['products']['items']);
114+
self::assertArrayHasKey('crosssell_products', $response['products']['items'][0]);
115+
$crossSellProducts = $response['products']['items'][0]['crosssell_products'];
116+
self::assertCount(1, $crossSellProducts);
117+
$crossSellProduct = $crossSellProducts[0];
118+
self::assertArrayHasKey('sku', $crossSellProduct);
119+
self::assertArrayHasKey('name', $crossSellProduct);
120+
self::assertArrayHasKey('url_key', $crossSellProduct);
121+
self::assertEquals($crossSellProduct['sku'], 'simple');
122+
self::assertEquals($crossSellProduct['name'], 'Simple Cross Sell');
123+
self::assertEquals($crossSellProduct['url_key'], 'simple-cross-sell');
124+
}
125+
86126
/**
87127
* @magentoApiDataFixture Magento/Catalog/_files/products_upsell.php
88128
*/

0 commit comments

Comments
 (0)