Skip to content

Commit

Permalink
387-Test coverage of getting IDs of CMS page/blocks by GraphQL API
Browse files Browse the repository at this point in the history
  • Loading branch information
atwixfirster committed May 6, 2019
1 parent b4ea6b9 commit 4ee64a5
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions app/code/Magento/CmsGraphQl/Model/Resolver/DataProvider/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

/**
Expand All @@ -72,7 +71,7 @@ public function __construct(
public function getData(int $pageId): array
{
$page = $this->pageRepository->getById($pageId);

return $this->convertPageData($page);
}

Expand Down

0 comments on commit 4ee64a5

Please sign in to comment.