-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LYNX-304: Added StoreConfig extra fields
- Loading branch information
Showing
9 changed files
with
193 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/************************************************************************ | ||
* | ||
* Copyright 2023 Adobe | ||
* All Rights Reserved. | ||
* | ||
* NOTICE: All information contained herein is, and remains | ||
* the property of Adobe and its suppliers, if any. The intellectual | ||
* and technical concepts contained herein are proprietary to Adobe | ||
* and its suppliers and are protected by all applicable intellectual | ||
* property laws, including trade secret and copyright laws. | ||
* Dissemination of this information or reproduction of this material | ||
* is strictly forbidden unless prior written permission is obtained | ||
* from Adobe. | ||
* ************************************************************************ | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> | ||
<type name="Magento\StoreGraphQl\Model\Resolver\Store\StoreConfigDataProvider"> | ||
<arguments> | ||
<argument name="extendedConfigData" xsi:type="array"> | ||
<item name="shopping_cart_display_price" xsi:type="string">tax/cart_display/price</item> | ||
<item name="shopping_cart_display_shipping" xsi:type="string">tax/cart_display/shipping</item> | ||
<item name="shopping_cart_display_subtotal" xsi:type="string">tax/cart_display/subtotal</item> | ||
<item name="shopping_cart_display_grand_total" xsi:type="string">tax/cart_display/grandtotal</item> | ||
<item name="shopping_cart_display_full_summary" xsi:type="string">tax/cart_display/full_summary</item> | ||
<item name="shopping_cart_display_zero_tax" xsi:type="string">tax/cart_display/zero_tax</item> | ||
</argument> | ||
</arguments> | ||
</type> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/StoreConfigResolverTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\GraphQl\Quote; | ||
|
||
use Magento\Checkout\Helper\Data; | ||
use Magento\Store\Model\ScopeInterface; | ||
use Magento\TestFramework\Fixture\Config as ConfigFixture; | ||
use Magento\TestFramework\TestCase\GraphQlAbstract; | ||
|
||
/** | ||
* Test the GraphQL endpoint's StoreConfigs query | ||
*/ | ||
class StoreConfigResolverTest extends GraphQlAbstract | ||
{ | ||
#[ | ||
ConfigFixture(Data::XML_PATH_GUEST_CHECKOUT, true, ScopeInterface::SCOPE_STORE, 'default'), | ||
ConfigFixture('checkout/options/onepage_checkout_enabled', true, ScopeInterface::SCOPE_STORE, 'default'), | ||
] | ||
public function testGetStoreConfig(): void | ||
{ | ||
$query | ||
= <<<QUERY | ||
{ | ||
storeConfig { | ||
is_guest_checkout_enabled, | ||
is_one_page_checkout_enabled, | ||
} | ||
} | ||
QUERY; | ||
$response = $this->graphQlQuery($query); | ||
$this->assertArrayHasKey('storeConfig', $response); | ||
$this->validateStoreConfig($response['storeConfig']); | ||
} | ||
|
||
/** | ||
* Validate Store Config Data | ||
* | ||
* @param array $responseConfig | ||
*/ | ||
private function validateStoreConfig( | ||
array $responseConfig, | ||
): void { | ||
$this->assertTrue($responseConfig['is_guest_checkout_enabled']); | ||
$this->assertTrue($responseConfig['is_one_page_checkout_enabled']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
dev/tests/api-functional/testsuite/Magento/GraphQl/Tax/StoreConfigResolverTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\GraphQl\Tax; | ||
|
||
use Magento\Directory\Helper\Data; | ||
use Magento\Store\Model\ScopeInterface; | ||
use Magento\TestFramework\Fixture\Config as ConfigFixture; | ||
use Magento\TestFramework\TestCase\GraphQlAbstract; | ||
use Magento\Tax\Model\Config; | ||
|
||
/** | ||
* Test the GraphQL endpoint's StoreConfigs query | ||
*/ | ||
class StoreConfigResolverTest extends GraphQlAbstract | ||
{ | ||
#[ | ||
ConfigFixture(Config::XML_PATH_DISPLAY_CART_PRICE, 1, ScopeInterface::SCOPE_STORE, 'default'), | ||
ConfigFixture(Config::XML_PATH_DISPLAY_CART_SHIPPING, 1, ScopeInterface::SCOPE_STORE, 'default'), | ||
ConfigFixture(Config::XML_PATH_DISPLAY_CART_SUBTOTAL, 1, ScopeInterface::SCOPE_STORE, 'default'), | ||
ConfigFixture(Config::XML_PATH_DISPLAY_CART_GRANDTOTAL, 1, ScopeInterface::SCOPE_STORE, 'default'), | ||
ConfigFixture(Config::XML_PATH_DISPLAY_CART_FULL_SUMMARY, 1, ScopeInterface::SCOPE_STORE, 'default'), | ||
ConfigFixture(Config::XML_PATH_DISPLAY_CART_ZERO_TAX, 1, ScopeInterface::SCOPE_STORE, 'default'), | ||
] | ||
public function testGetStoreConfig(): void | ||
{ | ||
$query | ||
= <<<QUERY | ||
{ | ||
storeConfig { | ||
shopping_cart_display_price, | ||
shopping_cart_display_shipping, | ||
shopping_cart_display_subtotal, | ||
shopping_cart_display_grand_total, | ||
shopping_cart_display_full_summary, | ||
shopping_cart_display_zero_tax, | ||
} | ||
} | ||
QUERY; | ||
$response = $this->graphQlQuery($query); | ||
$this->assertArrayHasKey('storeConfig', $response); | ||
$this->validateStoreConfig($response['storeConfig']); | ||
} | ||
|
||
/** | ||
* Validate Store Config Data | ||
* | ||
* @param array $responseConfig | ||
*/ | ||
private function validateStoreConfig( | ||
array $responseConfig, | ||
): void { | ||
$this->assertEquals(1, $responseConfig['shopping_cart_display_price']); | ||
$this->assertEquals(1, $responseConfig['shopping_cart_display_shipping']); | ||
$this->assertEquals(1, $responseConfig['shopping_cart_display_subtotal']); | ||
$this->assertEquals(1, $responseConfig['shopping_cart_display_grand_total']); | ||
$this->assertEquals(1, $responseConfig['shopping_cart_display_full_summary']); | ||
$this->assertEquals(1, $responseConfig['shopping_cart_display_zero_tax']); | ||
} | ||
} |