Skip to content

Commit 982d64a

Browse files
author
Oleksandr Iegorov
committed
MC-29026: GraphQL returns filters with some data if you making request to not existing or empty category
1 parent 1030ac0 commit 982d64a

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,37 @@
3131
*/
3232
class ProductSearchTest extends GraphQlAbstract
3333
{
34+
/**
35+
* Verify that filters for non-existing category are empty
36+
*
37+
* @throws \Exception
38+
*/
39+
public function testFilterForNonExistingCategory()
40+
{
41+
$query = <<<QUERY
42+
{
43+
products(filter: {category_id: {eq: "99999999"}}) {
44+
filters {
45+
name
46+
}
47+
}
48+
}
49+
QUERY;
50+
51+
$response = $this->graphQlQuery($query);
52+
53+
$this->assertArrayHasKey(
54+
'filters',
55+
$response['products'],
56+
'Filters are missing in product query result.'
57+
);
58+
59+
$this->assertEmpty(
60+
$response['products']['filters'],
61+
'Returned filters data set does not empty'
62+
);
63+
}
64+
3465
/**
3566
* Verify that layered navigation filters and aggregations are correct for product query
3667
*

0 commit comments

Comments
 (0)