From 8e426fe9a0b4e5dcaba084224d0b0a98c82e5e07 Mon Sep 17 00:00:00 2001 From: RomanKis Date: Thu, 30 Nov 2017 14:24:59 +0200 Subject: [PATCH] 12482: Sitemap image links in MultiStore --- app/code/Magento/Sitemap/Model/Sitemap.php | 1 + app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/app/code/Magento/Sitemap/Model/Sitemap.php b/app/code/Magento/Sitemap/Model/Sitemap.php index f6a5f029eafca..cad8023bd2794 100644 --- a/app/code/Magento/Sitemap/Model/Sitemap.php +++ b/app/code/Magento/Sitemap/Model/Sitemap.php @@ -273,6 +273,7 @@ public function collectSitemapItems() /** @var $helper \Magento\Sitemap\Helper\Data */ $helper = $this->_sitemapData; $storeId = $this->getStoreId(); + $this->_storeManager->setCurrentStore($storeId); $this->addSitemapItem(new DataObject( [ diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php index 83210c5789776..4f55653fad311 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php @@ -253,6 +253,8 @@ public function testGenerateXml($maxLines, $maxFileSize, $expectedFile, $expecte $expectedWrites, null ); + $this->storeManagerMock->expects($this->once())->method('setCurrentStore')->with(1); + $model->generateXml(); $this->assertCount(count($expectedFile), $actualData, 'Number of generated files is incorrect'); @@ -360,6 +362,8 @@ public function testAddSitemapToRobotsTxt($maxLines, $maxFileSize, $expectedFile $expectedWrites, $robotsInfo ); + $this->storeManagerMock->expects($this->once())->method('setCurrentStore')->with(1); + $model->generateXml(); }