From 787d31b2f9d7eba3de123c5bcb799f8ff016b9d0 Mon Sep 17 00:00:00 2001 From: Valerii Naida Date: Wed, 8 May 2019 13:16:42 -0500 Subject: [PATCH] GraphQl-387: Test coverage of getting IDs of CMS page/blocks by GraphQL API --- .../Magento/CmsGraphQl/Model/Resolver/DataProvider/Page.php | 2 ++ app/code/Magento/CmsGraphQl/Model/Resolver/Page.php | 2 +- .../testsuite/Magento/GraphQl/Cms/CmsBlockTest.php | 3 +++ .../testsuite/Magento/GraphQl/Cms/CmsPageTest.php | 3 +++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/CmsGraphQl/Model/Resolver/DataProvider/Page.php b/app/code/Magento/CmsGraphQl/Model/Resolver/DataProvider/Page.php index 8b9766ca311c..40825e70a994 100644 --- a/app/code/Magento/CmsGraphQl/Model/Resolver/DataProvider/Page.php +++ b/app/code/Magento/CmsGraphQl/Model/Resolver/DataProvider/Page.php @@ -88,6 +88,8 @@ public function getDataByPageIdentifier(string $pageIdentifier): array } /** + * Convert page data + * * @param PageInterface $page * @return array * @throws NoSuchEntityException diff --git a/app/code/Magento/CmsGraphQl/Model/Resolver/Page.php b/app/code/Magento/CmsGraphQl/Model/Resolver/Page.php index fbd8e2603095..64891cfeaa87 100644 --- a/app/code/Magento/CmsGraphQl/Model/Resolver/Page.php +++ b/app/code/Magento/CmsGraphQl/Model/Resolver/Page.php @@ -45,7 +45,7 @@ public function resolve( array $value = null, array $args = null ) { - if (!isset($args['id'], $args['identifier'])) { + if (!isset($args['id']) && !isset($args['identifier'])) { throw new GraphQlInputException(__('"Page id/identifier should be specified')); } diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Cms/CmsBlockTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Cms/CmsBlockTest.php index 542b00d434db..d598a463a48a 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Cms/CmsBlockTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Cms/CmsBlockTest.php @@ -13,6 +13,9 @@ use Magento\TestFramework\TestCase\GraphQlAbstract; use Magento\Widget\Model\Template\FilterEmulate; +/** + * Get CMS Block test + */ class CmsBlockTest extends GraphQlAbstract { /** diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Cms/CmsPageTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Cms/CmsPageTest.php index 53e47185c986..afbb3d40bc92 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Cms/CmsPageTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Cms/CmsPageTest.php @@ -11,6 +11,9 @@ use Magento\TestFramework\ObjectManager; use Magento\TestFramework\TestCase\GraphQlAbstract; +/** + * Get CMS Page test + */ class CmsPageTest extends GraphQlAbstract { /**