Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

128 extend store config coverage #130

Closed
wants to merge 41 commits into from

Conversation

VitaliyBoyko
Copy link
Contributor

Added extended params to store config.

Fixed Issues (if relevant)

  1. Extend GraphQL store config implementation #128: Extend GraphQL store config implementation

Added configs:
front : "Default Web URL"
cms_home_page : "CMS Home Page"
no_route : "Default No-route URL"
cms_no_route : "CMS No Route Page"
cms_no_cookies : "CMS No Cookies Page"
show_cms_breadcrumbs : "Show Breadcrumbs for CMS Pages"
head_shortcut_icon : "Favicon Icon"
default_title : "Default Page Title"
title_prefix : "Page Title Prefix"
title_suffix : "Page Title Suffix"
default_description : "Default Meta Description"
default_keywords : "Default Meta Keywords"
head_includes : "Scripts and Style Sheets"
demonotice : "Display Demo Store Notice"
header_logo_src : "Logo Image"
logo_width : "Logo Attribute Width"
logo_height : "Logo Attribute Height"
welcome : "Welcome Text"
logo_alt : "Logo Image Alt"
absolute_footer : "Footer Miscellaneous HTML"
copyright : "Copyright"

@vkublytskyi vkublytskyi self-requested a review July 26, 2018 13:55
<argument name="extendedConfigs" xsi:type="array">
<!-- Begin Store Configuration Web Default Pages -->
<item name="front" xsi:type="string">web/default/front</item>
<item name="cms_home_page" xsi:type="string">web/default/cms_home_page</item>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such implementation introduces an implicit dependency on CMS and Theme modules. Since both of these modules will require GraphQL coverage I think it's better to move declarations of exporting config path to corresponding modules (CmsGraphQl and ThemeGraphQl)

@@ -54,8 +45,7 @@ public function __construct(
*/
public function getStoreConfig() : array
{
$storeId = $this->storeResolver->getCurrentStoreId();
$store = $this->storeRepository->getById($storeId);
$store = $this->storeManager->getStore();
$storeConfig = current($this->storeConfigManager->getStoreConfigs([$store->getCode()]));

return $this->hidrateStoreConfig($storeConfig);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"hidrate" should be "hydrate"

<arguments>
<argument name="extendedConfigs" xsi:type="array">
<!-- Begin Store Configuration Web Default Pages -->
<item name="front" xsi:type="string">web/default/front</item>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just as proposition, and I would like to have an opinion of @paliarush or @vrann, maybe define some standard at least in Magento code, then items names will look like:
web_default_front - which is equal to web/default/front ? Then for developers will be easier to find items without looking into documentation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good point.
Would be nice to avoid having coupling between di.xml and schema.graphqls and have just one declaration in schema.graphqls, but unfortunately config_path_with_underscore cannot be reliably converted to config/path/with_underscore.

*/
public function testExtendedStoreConfig()
{
$front = 'test_page';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please check those values? Looks like they are not same in database:

Magento\GraphQl\Store\StoreConfigResolverTest::testExtendedStoreConfig
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'test_page'
+'cms'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@magentoConfigFixture does not work at the moment in Web API tests, @melnikovi is working on the fix

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should skip/rewrite this test until config fixture is supported.

@@ -52,7 +61,10 @@ public function resolve(
array $args = null
) : Value {

$storeConfigData = $this->storeConfigDataProvider->getStoreConfig();
$storeConfigData = array_merge(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use just one config provider and the list of accessible fields should be filtered according to the extensible di.xml

Copy link
Contributor Author

@VitaliyBoyko VitaliyBoyko Jul 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @paliarush
God point
But, the decision with one config provider doesn't right here.
We getting configs from different sources, StoreConfigDataProvider gets data from StoreConfigInterface unlike ExtendedStoreConfigDataProvider which gets data from ScopeConfigInterface.
It is not possible to get all StoreConfigInterface fields from ScopeConfigInterface.
For example base_url not present in core_config_data and defines in app/code/Magento/Store/Model/Store.php:607.

"magento/framework": "*"
},
"suggest": {
"magento/module-graph-ql": "*",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have dependency on CMS module (or at least suggest, if there are no hard dependencies)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi
I guess Travis will fail in this case with the "redundant dependency" error.

@naydav naydav added requires-tests PRs which require GraphQL tests requires-documentation labels Aug 21, 2018
@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Sep 11, 2018

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
3 out of 4 committers have signed the CLA.

✅ VitaliyBoyko
✅ TomashKhamlai
✅ naydav
❌ skmomemo

vitaliyboyko and others added 6 commits September 11, 2018 14:39
…re-config-coverage

# Conflicts:
#	app/code/Magento/BundleGraphQl/Model/Resolver/BundleItemLinks.php
#	app/code/Magento/StoreGraphQl/Model/Resolver/Store/StoreConfigDataProvider.php
#	app/code/Magento/StoreGraphQl/Model/Resolver/StoreConfigResolver.php
#	composer.lock
#	dev/tests/api-functional/testsuite/Magento/GraphQl/Cms/CmsBlockTest.php
VitaliyBoyko pushed a commit that referenced this pull request Sep 12, 2018
Signed-off-by: vitaliyboyko <[email protected]>
@VitaliyBoyko
Copy link
Contributor Author

Implementation has been moved to other pr:
#182

@VitaliyBoyko VitaliyBoyko deleted the 128-extend-store-config-coverage branch September 12, 2018 17:22
magento-engcom-team pushed a commit that referenced this pull request Jul 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants