Skip to content

Commit

Permalink
ENGCOM-5092: GraphQl-535: provided catalog configs magento#650
Browse files Browse the repository at this point in the history
  • Loading branch information
naydav authored May 8, 2019
2 parents beb058c + ff754e8 commit 42f5c82
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/code/Magento/CatalogGraphQl/etc/graphql/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,19 @@
</virtualType>
<preference for="Magento\Framework\Search\Adapter\Mysql\Query\Builder\Match"
type="Magento\CatalogGraphQl\Model\Search\Adapter\Mysql\Query\Builder\Match" />
<type name="Magento\StoreGraphQl\Model\Resolver\Store\StoreConfigDataProvider">
<arguments>
<argument name="extendedConfigData" xsi:type="array">
<item name="product_url_suffix" xsi:type="string">catalog/seo/product_url_suffix</item>
<item name="category_url_suffix" xsi:type="string">catalog/seo/category_url_suffix</item>
<item name="title_separator" xsi:type="string">catalog/seo/title_separator</item>
<item name="list_mode" xsi:type="string">catalog/frontend/list_mode</item>
<item name="grid_per_page_values" xsi:type="string">catalog/frontend/grid_per_page_values</item>
<item name="list_per_page_values" xsi:type="string">catalog/frontend/list_per_page_values</item>
<item name="grid_per_page" xsi:type="string">catalog/frontend/grid_per_page</item>
<item name="list_per_page" xsi:type="string">catalog/frontend/list_per_page</item>
<item name="catalog_default_sort_by" xsi:type="string">catalog/frontend/default_sort_by</item>
</argument>
</arguments>
</type>
</config>
12 changes: 12 additions & 0 deletions app/code/Magento/CatalogGraphQl/etc/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -401,3 +401,15 @@ type SortFields @doc(description: "SortFields contains a default value for sort
default: String @doc(description: "Default value of sort fields")
options: [SortField] @doc(description: "Available sort fields")
}

type StoreConfig @doc(description: "The type contains information about a store config") {
product_url_suffix : String @doc(description: "Product URL Suffix")
category_url_suffix : String @doc(description: "Category URL Suffix")
title_separator : String @doc(description: "Page Title Separator")
list_mode : String @doc(description: "List Mode")
grid_per_page_values : String @doc(description: "Products per Page on Grid Allowed Values")
list_per_page_values : String @doc(description: "Products per Page on List Allowed Values")
grid_per_page : Int @doc(description: "Products per Page on Grid Default Value")
list_per_page : Int @doc(description: "Products per Page on List Default Value")
catalog_default_sort_by : String @doc(description: "Default Sort By")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\GraphQl\Catalog;

use Magento\TestFramework\TestCase\GraphQlAbstract;

/**
* Test the GraphQL endpoint's StoreConfigs query for Catalog Configs
*/
class StoreConfigTest extends GraphQlAbstract
{
protected function setUp()
{
$this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/167');
}

/**
* @magentoApiDataFixture Magento/Store/_files/store.php
*/
public function testGetStoreConfig()
{
$query
= <<<QUERY
{
storeConfig{
product_url_suffix,
category_url_suffix,
title_separator,
list_mode,
grid_per_page_values,
list_per_page_values,
grid_per_page,
list_per_page,
catalog_default_sort_by
}
}
QUERY;
$response = $this->graphQlQuery($query);
$this->assertArrayHasKey('storeConfig', $response);

//TODO: provide assertions after unmarking test as incomplete
}
}

0 comments on commit 42f5c82

Please sign in to comment.