From 4ee64a57bbaaf8c4564c589b1c2f794869da8d74 Mon Sep 17 00:00:00 2001 From: Alex Taranovsky Date: Mon, 6 May 2019 16:56:42 +0300 Subject: [PATCH] 387-Test coverage of getting IDs of CMS page/blocks by GraphQL API --- .../CmsGraphQl/Model/Resolver/DataProvider/Page.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/CmsGraphQl/Model/Resolver/DataProvider/Page.php b/app/code/Magento/CmsGraphQl/Model/Resolver/DataProvider/Page.php index cfeecd402828e..2001bc006bbb8 100644 --- a/app/code/Magento/CmsGraphQl/Model/Resolver/DataProvider/Page.php +++ b/app/code/Magento/CmsGraphQl/Model/Resolver/DataProvider/Page.php @@ -10,7 +10,6 @@ use Magento\Cms\Api\Data\PageInterface; use Magento\Cms\Api\GetPageByIdentifierInterface; use Magento\Cms\Api\PageRepositoryInterface; -use Magento\Framework\App\ObjectManager; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Store\Model\StoreManagerInterface; use Magento\Widget\Model\Template\FilterEmulate; @@ -49,14 +48,14 @@ class Page public function __construct( PageRepositoryInterface $pageRepository, FilterEmulate $widgetFilter, - GetPageByIdentifierInterface $getPageByIdentifier = null, - StoreManagerInterface $storeManager = null + GetPageByIdentifierInterface $getPageByIdentifier, + StoreManagerInterface $storeManager ) { $this->pageRepository = $pageRepository; $this->widgetFilter = $widgetFilter; - $this->pageByIdentifier = $getPageByIdentifier ?: ObjectManager::getInstance()->get(GetPageByIdentifierInterface::class); - $this->storeManager = $storeManager ?: ObjectManager::getInstance()->get(StoreManagerInterface::class); + $this->pageByIdentifier = $getPageByIdentifier; + $this->storeManager = $storeManager; } /** @@ -72,7 +71,7 @@ public function __construct( public function getData(int $pageId): array { $page = $this->pageRepository->getById($pageId); - + return $this->convertPageData($page); }