File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -63,4 +63,29 @@ public function testQueryProductOnlyXLeftInStockEnabled()
63
63
$ this ->assertArrayHasKey ('only_x_left_in_stock ' , $ response ['products ' ]['items ' ][0 ]);
64
64
$ this ->assertEquals (100 , $ response ['products ' ]['items ' ][0 ]['only_x_left_in_stock ' ]);
65
65
}
66
+
67
+ /**
68
+ * @magentoApiDataFixture Magento/Catalog/_files/product_simple_out_of_stock.php
69
+ * @magentoConfigFixture default_store cataloginventory/options/show_out_of_stock 1
70
+ */
71
+ public function testQueryProductOnlyXLeftInStockOutstock ()
72
+ {
73
+ $ productSku = 'simple-out-of-stock ' ;
74
+
75
+ $ query = <<<QUERY
76
+ {
77
+ products(filter: {sku: {eq: " {$ productSku }"}})
78
+ {
79
+ items {
80
+ only_x_left_in_stock
81
+ }
82
+ }
83
+ }
84
+ QUERY ;
85
+ $ response = $ this ->graphQlQuery ($ query );
86
+
87
+ $ this ->assertArrayHasKey (0 , $ response ['products ' ]['items ' ]);
88
+ $ this ->assertArrayHasKey ('only_x_left_in_stock ' , $ response ['products ' ]['items ' ][0 ]);
89
+ $ this ->assertEquals (0 , $ response ['products ' ]['items ' ][0 ]['only_x_left_in_stock ' ]);
90
+ }
66
91
}
You can’t perform that action at this time.
0 commit comments