Skip to content

Commit

Permalink
MAGETWO-70872: [WIP]Google Sitemap refactoring - introduce item resol…
Browse files Browse the repository at this point in the history
…ver #10288

 - fixed static tests
  • Loading branch information
Oleksii Korshenko committed Jul 27, 2017
1 parent a53794d commit fe36cf2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions app/code/Magento/Sitemap/Model/Sitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class Sitemap extends \Magento\Framework\Model\AbstractModel implements \Magento
/**
* Sitemap Item Factory
*
* @var SitemapItemInterfaceFactory|null
* @var \Magento\Sitemap\Model\SitemapItemInterfaceFactory
*/
private $sitemapItemFactory;

Expand All @@ -203,7 +203,7 @@ class Sitemap extends \Magento\Framework\Model\AbstractModel implements \Magento
* @param DocumentRoot|null $documentRoot
* @param ItemResolverInterface|null $itemResolver
* @param SitemapConfigReaderInterface|null $configReader
* @param SitemapItemInterfaceFactory|null $sitemapItemFactory
* @param \Magento\Sitemap\Model\SitemapItemInterfaceFactory|null $sitemapItemFactory
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
Expand All @@ -225,12 +225,11 @@ public function __construct(
\Magento\Config\Model\Config\Reader\Source\Deployed\DocumentRoot $documentRoot = null,
ItemResolverInterface $itemResolver = null,
SitemapConfigReaderInterface $configReader = null,
SitemapItemInterfaceFactory $sitemapItemFactory = null
\Magento\Sitemap\Model\SitemapItemInterfaceFactory $sitemapItemFactory = null
) {
$objectManager = ObjectManager::getInstance();
$this->_escaper = $escaper;
$this->_sitemapData = $sitemapData;
$documentRoot = $documentRoot ?: $objectManager->get(DocumentRoot::class);
$documentRoot = $documentRoot ?: ObjectManager::getInstance()->get(DocumentRoot::class);
$this->_directory = $filesystem->getDirectoryWrite($documentRoot->getPath());
$this->_categoryFactory = $categoryFactory;
$this->_productFactory = $productFactory;
Expand All @@ -239,9 +238,11 @@ public function __construct(
$this->_storeManager = $storeManager;
$this->_request = $request;
$this->dateTime = $dateTime;
$this->itemResolver = $itemResolver ?: $objectManager->get(ItemResolverInterface::class);
$this->configReader = $configReader ?: $objectManager->get(SitemapConfigReaderInterface::class);
$this->sitemapItemFactory = $sitemapItemFactory ?: $objectManager->get(SitemapItemInterfaceFactory::class);
$this->itemResolver = $itemResolver ?: ObjectManager::getInstance()->get(ItemResolverInterface::class);
$this->configReader = $configReader ?: ObjectManager::getInstance()->get(SitemapConfigReaderInterface::class);
$this->sitemapItemFactory = $sitemapItemFactory ?: ObjectManager::getInstance()->get(
\Magento\Sitemap\Model\SitemapItemInterfaceFactory::class
);
parent::__construct($context, $registry, $resource, $resourceCollection, $data);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* See COPYING.txt for license details.
*/

namespace Magento\Sitemap\Test\Unit\Model;
namespace Magento\Sitemap\Test\Unit\Model\ItemResolver;

use Magento\Framework\DataObject;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
Expand Down

0 comments on commit fe36cf2

Please sign in to comment.