Skip to content

Commit 9d240e3

Browse files
author
Vitaliy Boyko
committed
graphQl-535: provided catalog configs
1 parent 93a8162 commit 9d240e3

File tree

3 files changed

+96
-0
lines changed

3 files changed

+96
-0
lines changed

app/code/Magento/CatalogGraphQl/etc/graphql/di.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,26 @@
8080
</virtualType>
8181
<preference for="Magento\Framework\Search\Adapter\Mysql\Query\Builder\Match"
8282
type="Magento\CatalogGraphQl\Model\Search\Adapter\Mysql\Query\Builder\Match" />
83+
<type name="Magento\StoreGraphQl\Model\Resolver\Store\StoreConfigDataProvider">
84+
<arguments>
85+
<argument name="extendedConfigData" xsi:type="array">
86+
<item name="product_url_suffix" xsi:type="string">catalog/seo/product_url_suffix</item>
87+
<item name="category_url_suffix" xsi:type="string">catalog/seo/category_url_suffix</item>
88+
<item name="product_use_categories" xsi:type="string">catalog/seo/product_use_categories</item>
89+
<item name="save_rewrites_history" xsi:type="string">catalog/seo/save_rewrites_history</item>
90+
<item name="title_separator" xsi:type="string">catalog/seo/title_separator</item>
91+
<item name="category_canonical_tag" xsi:type="string">catalog/seo/category_canonical_tag</item>
92+
<item name="product_canonical_tag" xsi:type="string">catalog/seo/product_canonical_tag</item>
93+
<item name="list_mode" xsi:type="string">catalog/frontend/list_mode</item>
94+
<item name="grid_per_page_values" xsi:type="string">catalog/frontend/grid_per_page_values</item>
95+
<item name="list_per_page_values" xsi:type="string">catalog/frontend/list_per_page_values</item>
96+
<item name="grid_per_page" xsi:type="string">catalog/frontend/grid_per_page</item>
97+
<item name="list_per_page" xsi:type="string">catalog/frontend/list_per_page</item>
98+
<item name="flat_catalog_category" xsi:type="string">catalog/frontend/flat_catalog_category</item>
99+
<item name="catalog_default_sort_by" xsi:type="string">catalog/frontend/default_sort_by</item>
100+
<item name="parse_url_directives" xsi:type="string">catalog/frontend/parse_url_directives</item>
101+
<item name="remember_pagination" xsi:type="string">catalog/frontend/remember_pagination</item>
102+
</argument>
103+
</arguments>
104+
</type>
83105
</config>

app/code/Magento/CatalogGraphQl/etc/schema.graphqls

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,3 +401,22 @@ type SortFields @doc(description: "SortFields contains a default value for sort
401401
default: String @doc(description: "Default value of sort fields")
402402
options: [SortField] @doc(description: "Available sort fields")
403403
}
404+
405+
type StoreConfig @doc(description: "The type contains information about a store config") {
406+
product_url_suffix : String @doc(description: "Product URL Suffix")
407+
category_url_suffix : String @doc(description: "Category URL Suffix")
408+
product_use_categories : Int @doc(description: "Use Categories Path for Product URLs")
409+
save_rewrites_history : Int @doc(description: "Create Permanent Redirect for URLs if URL Key Changed")
410+
title_separator : String @doc(description: "Page Title Separator")
411+
category_canonical_tag : Int @doc(description: "Use Canonical Link Meta Tag For Categories")
412+
product_canonical_tag : Int @doc(description: "Use Canonical Link Meta Tag For Products")
413+
list_mode : String @doc(description: "List Mode")
414+
grid_per_page_values : String @doc(description: "Products per Page on Grid Allowed Values")
415+
list_per_page_values : String @doc(description: "Products per Page on List Allowed Values")
416+
grid_per_page : Int @doc(description: "Products per Page on Grid Default Value")
417+
list_per_page : Int @doc(description: "Products per Page on List Default Value")
418+
flat_catalog_category : Int @doc(description: "Use Flat Catalog Category")
419+
catalog_default_sort_by : String @doc(description: "Default Sort By")
420+
parse_url_directives : Int @doc(description: "Parse URL directives")
421+
remember_pagination : Int @doc(description: "Remember Pagination")
422+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\GraphQl\Store;
9+
10+
use Magento\TestFramework\TestCase\GraphQlAbstract;
11+
12+
/**
13+
* Test the GraphQL endpoint's StoreConfigs query for Catalog Configs
14+
*/
15+
class StoreConfigTest extends GraphQlAbstract
16+
{
17+
protected function setUp()
18+
{
19+
$this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/167');
20+
}
21+
22+
/**
23+
* @magentoApiDataFixture Magento/Store/_files/store.php
24+
*/
25+
public function testGetStoreConfig()
26+
{
27+
$query
28+
= <<<QUERY
29+
{
30+
storeConfig{
31+
product_url_suffix,
32+
category_url_suffix,
33+
product_use_categories,
34+
save_rewrites_history,
35+
title_separator,
36+
category_canonical_tag,
37+
product_canonical_tag,
38+
list_mode,
39+
grid_per_page_values,
40+
list_per_page_values,
41+
grid_per_page,
42+
list_per_page,
43+
flat_catalog_category,
44+
catalog_default_sort_by,
45+
parse_url_directives,
46+
remember_pagination
47+
}
48+
}
49+
QUERY;
50+
$response = $this->graphQlQuery($query);
51+
$this->assertArrayHasKey('storeConfig', $response);
52+
53+
//TODO: provide assertions after unmarking test as incomplete
54+
}
55+
}

0 commit comments

Comments
 (0)