Skip to content

Commit 34a05f7

Browse files
committed
skip AC-10660 ticket fix changes
1 parent 151c3bb commit 34a05f7

File tree

3 files changed

+13
-37
lines changed

3 files changed

+13
-37
lines changed

app/code/Magento/Catalog/Controller/Product/Compare/Index.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77
namespace Magento\Catalog\Controller\Product\Compare;
88

9-
use Magento\Catalog\Api\ProductRepositoryInterface;
109
use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
10+
use Magento\Catalog\Api\ProductRepositoryInterface;
1111
use Magento\Framework\Data\Form\FormKey\Validator;
1212
use Magento\Framework\View\Result\PageFactory;
1313

@@ -81,8 +81,6 @@ public function execute()
8181
$this->_catalogSession->setBeforeCompareUrl(
8282
$this->urlDecoder->decode($beforeUrl)
8383
);
84-
} else {
85-
$this->_catalogSession->unsBeforeCompareUrl();
8684
}
8785
return $this->resultPageFactory->create();
8886
}

app/code/Magento/Catalog/CustomerData/CompareProducts.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use Magento\Framework\App\Config\ScopeConfigInterface;
1010
use Magento\Framework\App\ObjectManager;
1111
use Magento\Framework\Exception\LocalizedException;
12-
use Magento\Framework\UrlInterface;
1312
use Magento\Store\Model\StoreManagerInterface;
1413

1514
/**
@@ -44,33 +43,25 @@ class CompareProducts implements SectionSourceInterface
4443
*/
4544
private $storeManager;
4645

47-
/**
48-
* @var UrlInterface
49-
*/
50-
private $urlBuilder;
51-
5246
/**
5347
* @param \Magento\Catalog\Helper\Product\Compare $helper
5448
* @param \Magento\Catalog\Model\Product\Url $productUrl
5549
* @param \Magento\Catalog\Helper\Output $outputHelper
5650
* @param ScopeConfigInterface|null $scopeConfig
5751
* @param StoreManagerInterface|null $storeManager
58-
* @param UrlInterface|null $urlBuilder
5952
*/
6053
public function __construct(
6154
\Magento\Catalog\Helper\Product\Compare $helper,
6255
\Magento\Catalog\Model\Product\Url $productUrl,
6356
\Magento\Catalog\Helper\Output $outputHelper,
6457
?ScopeConfigInterface $scopeConfig = null,
65-
?StoreManagerInterface $storeManager = null,
66-
?UrlInterface $urlBuilder = null
58+
?StoreManagerInterface $storeManager = null
6759
) {
6860
$this->helper = $helper;
6961
$this->productUrl = $productUrl;
7062
$this->outputHelper = $outputHelper;
7163
$this->scopeConfig = $scopeConfig ?? ObjectManager::getInstance()->get(ScopeConfigInterface::class);
7264
$this->storeManager = $storeManager ?? ObjectManager::getInstance()->get(StoreManagerInterface::class);
73-
$this->urlBuilder = $urlBuilder ?? ObjectManager::getInstance()->get(UrlInterface::class);
7465
}
7566

7667
/**
@@ -82,7 +73,7 @@ public function getSectionData()
8273
return [
8374
'count' => $count,
8475
'countCaption' => $count == 1 ? __('1 item') : __('%1 items', $count),
85-
'listUrl' => $this->urlBuilder->getUrl('catalog/product_compare/index'),
76+
'listUrl' => $this->helper->getListUrl(),
8677
'items' => $count ? $this->getItems() : [],
8778
'websiteId' => $this->storeManager->getWebsite()->getId()
8879
];

app/code/Magento/Catalog/Test/Unit/CustomerData/CompareProductsTest.php

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,11 @@
1717
use Magento\Catalog\Model\ResourceModel\Product\Compare\Item\Collection;
1818
use Magento\Framework\App\Config\ScopeConfigInterface;
1919
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
20-
use Magento\Framework\UrlInterface;
21-
use Magento\Store\Model\StoreManagerInterface;
2220
use Magento\Store\Model\Website;
2321
use PHPUnit\Framework\MockObject\MockObject;
2422
use PHPUnit\Framework\TestCase;
23+
use Magento\Store\Model\StoreManagerInterface;
2524

26-
/**
27-
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
28-
*/
2925
class CompareProductsTest extends TestCase
3026
{
3127
/**
@@ -68,11 +64,6 @@ class CompareProductsTest extends TestCase
6864
*/
6965
private $websiteMock;
7066

71-
/**
72-
* @var UrlInterface|MockObject
73-
*/
74-
private $urlBuilder;
75-
7667
/**
7768
* @var array
7869
*/
@@ -97,9 +88,6 @@ protected function setUp(): void
9788
$this->scopeConfigMock = $this->getMockBuilder(ScopeConfigInterface::class)
9889
->disableOriginalConstructor()
9990
->getMockForAbstractClass();
100-
$this->urlBuilder = $this->getMockBuilder(UrlInterface::class)
101-
->disableOriginalConstructor()
102-
->getMock();
10391

10492
$this->storeManagerMock = $this->getMockBuilder(
10593
StoreManagerInterface::class
@@ -109,7 +97,7 @@ protected function setUp(): void
10997
$this->websiteMock = $this->getMockBuilder(
11098
Website::class
11199
)->onlyMethods(
112-
['getId']
100+
['getId',]
113101
)->disableOriginalConstructor()
114102
->getMock();
115103

@@ -122,8 +110,8 @@ protected function setUp(): void
122110
'productUrl' => $this->productUrlMock,
123111
'outputHelper' => $this->outputHelperMock,
124112
'scopeConfig' => $this->scopeConfigMock,
125-
'storeManager' => $this->storeManagerMock,
126-
'urlBuilder' => $this->urlBuilder
113+
'storeManager' => $this->storeManagerMock
114+
127115
]
128116
);
129117
}
@@ -231,10 +219,9 @@ public function testGetSectionData()
231219
->method('getItemCollection')
232220
->willReturn($itemCollectionMock);
233221

234-
$this->urlBuilder->expects($this->once())
235-
->method('getUrl')
222+
$this->helperMock->expects($this->once())
223+
->method('getListUrl')
236224
->willReturn('http://list.url');
237-
238225
$this->storeManagerMock->expects($this->any())->method('getWebsite')->willReturn($this->websiteMock);
239226
$this->websiteMock->expects($this->any())->method('getId')->willReturn(1);
240227
$this->assertEquals(
@@ -282,8 +269,8 @@ public function testGetSectionDataNoItems()
282269
$this->helperMock->expects($this->never())
283270
->method('getItemCollection');
284271

285-
$this->urlBuilder->expects($this->once())
286-
->method('getUrl')
272+
$this->helperMock->expects($this->once())
273+
->method('getListUrl')
287274
->willReturn('http://list.url');
288275

289276
$this->storeManagerMock->expects($this->any())->method('getWebsite')->willReturn($this->websiteMock);
@@ -327,8 +314,8 @@ public function testGetSectionDataSingleItem()
327314
->method('getItemCollection')
328315
->willReturn($itemCollectionMock);
329316

330-
$this->urlBuilder->expects($this->once())
331-
->method('getUrl')
317+
$this->helperMock->expects($this->once())
318+
->method('getListUrl')
332319
->willReturn('http://list.url');
333320

334321
$this->assertEquals(

0 commit comments

Comments
 (0)