Skip to content

Commit 5ec7784

Browse files
author
Oleksandr Iegorov
committed
ACP2E-363: Graphql categoryList does not filter based on Store header
1 parent 58b8bb5 commit 5ec7784

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,4 +887,36 @@ public function testFilterCategoryRecursiveFragment() : void
887887
$this->assertArrayHasKey('id', $result['categoryList'][0]['children'][0]);
888888
$this->assertEquals($result['categoryList'][0]['children'][0]['id'], '3');
889889
}
890+
891+
/**
892+
* Test category list is filtered based on store in header
893+
*
894+
* @magentoApiDataFixture Magento/Catalog/_files/categories.php
895+
* @magentoApiDataFixture Magento/Store/_files/store_with_second_root_category.php
896+
*/
897+
public function testFilterStoreRootCategory() : void
898+
{
899+
$query = <<<'QUERY'
900+
{
901+
categoryList(filters: {name: {match: "Category"}}) {
902+
uid
903+
level
904+
name
905+
breadcrumbs {
906+
category_uid
907+
category_name
908+
category_level
909+
category_url_key
910+
}
911+
}
912+
}
913+
QUERY;
914+
$result = $this->graphQlQuery($query);
915+
$this->assertArrayNotHasKey('errors', $result);
916+
$this->assertCount(7, $result['categoryList']);
917+
918+
$result = $this->graphQlQuery($query, [], '', ['store' => 'test_store_1']);
919+
$this->assertArrayNotHasKey('errors', $result);
920+
$this->assertCount(1, $result['categoryList']);
921+
}
890922
}

0 commit comments

Comments
 (0)