File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
dev/tests/api-functional/testsuite/Magento/GraphQl/RelatedProduct Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,40 @@ 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+
86120 /**
87121 * @magentoApiDataFixture Magento/Catalog/_files/products_crosssell.php
88122 */
You can’t perform that action at this time.
0 commit comments