Skip to content

Commit cc5ffeb

Browse files
committed
ACP2E-4249: Compare Products Count missmatch Issue for different stores
1 parent 7d6dff9 commit cc5ffeb

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

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

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Magento\Framework\UrlInterface;
2121
use Magento\Store\Model\StoreManagerInterface;
2222
use Magento\Store\Model\Website;
23+
use Magento\Store\Model\Store;
2324
use PHPUnit\Framework\MockObject\MockObject;
2425
use PHPUnit\Framework\TestCase;
2526

@@ -64,9 +65,9 @@ class CompareProductsTest extends TestCase
6465
private $storeManagerMock;
6566

6667
/**
67-
* @var Website|MockObject
68+
* @var Store|MockObject
6869
*/
69-
private $websiteMock;
70+
private $storeMock;
7071

7172
/**
7273
* @var UrlInterface|MockObject
@@ -106,8 +107,8 @@ protected function setUp(): void
106107
)->disableOriginalConstructor()
107108
->getMockForAbstractClass();
108109

109-
$this->websiteMock = $this->getMockBuilder(
110-
Website::class
110+
$this->storeMock= $this->getMockBuilder(
111+
Store::class
111112
)->onlyMethods(
112113
['getId']
113114
)->disableOriginalConstructor()
@@ -235,8 +236,8 @@ public function testGetSectionData()
235236
->method('getUrl')
236237
->willReturn('http://list.url');
237238

238-
$this->storeManagerMock->expects($this->any())->method('getWebsite')->willReturn($this->websiteMock);
239-
$this->websiteMock->expects($this->any())->method('getId')->willReturn(1);
239+
$this->storeManagerMock->expects($this->any())->method('getStore')->willReturn($this->storeMock);
240+
$this->storeMock->expects($this->any())->method('getId')->willReturn(1);
240241
$this->assertEquals(
241242
[
242243
'count' => $count,
@@ -265,7 +266,7 @@ public function testGetSectionData()
265266
'productScope' => null
266267
]
267268
],
268-
'websiteId' => 1
269+
'storeId' => 1
269270
],
270271
$this->model->getSectionData()
271272
);
@@ -286,16 +287,16 @@ public function testGetSectionDataNoItems()
286287
->method('getUrl')
287288
->willReturn('http://list.url');
288289

289-
$this->storeManagerMock->expects($this->any())->method('getWebsite')->willReturn($this->websiteMock);
290-
$this->websiteMock->expects($this->any())->method('getId')->willReturn(1);
290+
$this->storeManagerMock->expects($this->any())->method('getStore')->willReturn($this->storeMock);
291+
$this->storeMock->expects($this->any())->method('getId')->willReturn(1);
291292

292293
$this->assertEquals(
293294
[
294295
'count' => $count,
295296
'countCaption' => __('%1 items', $count),
296297
'listUrl' => 'http://list.url',
297298
'items' => [],
298-
'websiteId' => 1
299+
'storeId' => 1
299300
],
300301
$this->model->getSectionData()
301302
);
@@ -309,8 +310,8 @@ public function testGetSectionDataSingleItem()
309310
->method('getItemCount')
310311
->willReturn($count);
311312

312-
$this->storeManagerMock->expects($this->any())->method('getWebsite')->willReturn($this->websiteMock);
313-
$this->websiteMock->expects($this->any())->method('getId')->willReturn(1);
313+
$this->storeManagerMock->expects($this->any())->method('getStore')->willReturn($this->storeMock);
314+
$this->storeMock->expects($this->any())->method('getId')->willReturn(1);
314315

315316
$items = $this->prepareProductsWithCorrespondingMocks(
316317
[
@@ -345,7 +346,7 @@ public function testGetSectionDataSingleItem()
345346
'productScope' => null
346347
]
347348
],
348-
'websiteId' => 1
349+
'storeId' => 1
349350
],
350351
$this->model->getSectionData()
351352
);

0 commit comments

Comments
 (0)