diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Store/StoreConfigsResolverTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Store/StoreConfigsResolverTest.php new file mode 100644 index 0000000000000..5c3566ffe2e19 --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Store/StoreConfigsResolverTest.php @@ -0,0 +1,107 @@ +objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + } + + /** + * @magentoApiDataFixture Magento/Store/_files/store.php + */ + public function testStoreConfigsFilteredByStoreCode() + { + $storeCode = 'test'; + /** @var StoreConfigManagerInterface $storeConfigsManager */ + $storeConfigsManager = $this->objectManager->get(StoreConfigManagerInterface::class); + /** @var StoreConfigInterface $storeConfig */ + $storeConfig = current($storeConfigsManager->getStoreConfigs([$storeCode])); + $query + = <<graphQlQuery($query); + $this->assertArrayHasKey('storeConfigs', $response); + $this->assertEquals(1, count($response['storeConfigs']['items'])); + $responseStoreConfig = current($response['storeConfigs']['items']); + $this->assertEquals($storeConfig->getId(), $responseStoreConfig['id']); + $this->assertEquals($storeConfig->getCode(), $responseStoreConfig['code']); + $this->assertEquals($storeConfig->getLocale(), $responseStoreConfig['locale']); + $this->assertEquals($storeConfig->getBaseCurrencyCode(), $responseStoreConfig['base_currency_code']); + $this->assertEquals( + $storeConfig->getDefaultDisplayCurrencyCode(), + $responseStoreConfig['default_display_currency_code'] + ); + $this->assertEquals($storeConfig->getTimezone(), $responseStoreConfig['timezone']); + $this->assertEquals($storeConfig->getWeightUnit(), $responseStoreConfig['weight_unit']); + $this->assertEquals($storeConfig->getBaseUrl(), $responseStoreConfig['base_url']); + $this->assertEquals($storeConfig->getBaseLinkUrl(), $responseStoreConfig['base_link_url']); + $this->assertEquals($storeConfig->getBaseStaticUrl(), $responseStoreConfig['base_static_url']); + $this->assertEquals($storeConfig->getBaseMediaUrl(), $responseStoreConfig['base_media_url']); + $this->assertEquals($storeConfig->getSecureBaseUrl(), $responseStoreConfig['secure_base_url']); + $this->assertEquals($storeConfig->getSecureBaseLinkUrl(), $responseStoreConfig['secure_base_link_url']); + $this->assertEquals($storeConfig->getSecureBaseStaticUrl(), $responseStoreConfig['secure_base_static_url']); + $this->assertEquals($storeConfig->getSecureBaseMediaUrl(), $responseStoreConfig['secure_base_media_url']); + } + + /** + * @magentoApiDataFixture Magento/Store/_files/store.php + */ + public function testGetStoreConfigsWithoutStoreCodes() + { + $query + = <<graphQlQuery($query); + $this->assertArrayHasKey('storeConfigs', $response); + $this->assertEquals(2, count($response['storeConfigs']['items'])); + } +}