Skip to content

Commit 511825a

Browse files
committed
ACP2E-2964: [Cloud] URL update only for store_id=0
1 parent 05a952c commit 511825a

File tree

1 file changed

+20
-21
lines changed
  • app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Category

1 file changed

+20
-21
lines changed

app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Category/MoveTest.php

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -114,41 +114,40 @@ protected function setUp(): void
114114
public function testAfterChangeParent()
115115
{
116116
$urlPath = 'test/path';
117-
$storeIds = [0, 1];
117+
$storeId = 0;
118118

119-
$this->storeManagerMock->expects($this->exactly(2))->method('hasSingleStore')->willReturn(false);
120-
$this->categoryMock->expects($this->exactly(4))->method('getStoreId')
121-
->willReturnOnConsecutiveCalls(0, 0, 1, 0);
122-
$this->categoryMock->expects($this->once())->method('getStoreIds')->willReturn($storeIds);
123-
$this->categoryMock->expects($this->exactly(4))->method('setStoreId')
124-
->willReturnOnConsecutiveCalls(0, 0, 1, 0);
119+
$this->storeManagerMock->expects($this->once())->method('hasSingleStore')->willReturn(false);
120+
$this->categoryMock->expects($this->any())->method('getStoreId')
121+
->willReturn($storeId);
122+
$this->categoryMock->expects($this->any())->method('setStoreId')
123+
->willReturnOnConsecutiveCalls($storeId);
125124

126-
$this->categoryMock->expects($this->exactly(2))->method('getData')
125+
$this->categoryMock->expects($this->once())->method('getData')
127126
->willReturnOnConsecutiveCalls('1/3/5', '1/3/5');
128-
$this->categoryMock->expects($this->exactly(2))->method('getOrigData')
127+
$this->categoryMock->expects($this->once())->method('getOrigData')
129128
->willReturnOnConsecutiveCalls('1/2/5', '1/2/5');
130-
$this->categoryMock->expects($this->exactly(6))->method('unsUrlPath')->willReturnSelf();
131-
$this->childrenCategoriesProviderMock->expects($this->exactly(4))->method('getChildren')
129+
$this->categoryMock->expects($this->any())->method('unsUrlPath')->willReturnSelf();
130+
$this->childrenCategoriesProviderMock->expects($this->any())->method('getChildren')
132131
->with($this->categoryMock, true)
133132
->willReturnOnConsecutiveCalls([$this->categoryMock], [$this->categoryMock], [], []);
134133

135-
$this->categoryMock->expects($this->exactly(6))->method('getResource')->willReturn($this->subjectMock);
136-
$this->subjectMock->expects($this->exactly(6))->method('saveAttribute')
134+
$this->categoryMock->expects($this->any())->method('getResource')->willReturn($this->subjectMock);
135+
$this->subjectMock->expects($this->any())->method('saveAttribute')
137136
->with($this->categoryMock, 'url_path')->willReturnSelf();
138-
$this->categoryMock->expects($this->exactly(2))->method('getId')->willReturnSelf();
137+
$this->categoryMock->expects($this->once())->method('getId')->willReturnSelf();
139138

140139
$originalCategory = $this->getMockBuilder(Category::class)->disableOriginalConstructor()->getMock();
141-
$originalCategory->expects($this->exactly(2))->method('getUrlKey')->willReturn('url-key');
142-
$originalCategory->expects($this->exactly(2))->method('setStoreId')->willReturnSelf();
143-
$originalCategory->expects($this->exactly(2))->method('load')->willReturnSelf();
144-
$this->categoryFactory->expects($this->exactly(2))->method('create')
140+
$originalCategory->expects($this->once())->method('getUrlKey')->willReturn('url-key');
141+
$originalCategory->expects($this->once())->method('setStoreId')->willReturnSelf();
142+
$originalCategory->expects($this->once())->method('load')->willReturnSelf();
143+
$this->categoryFactory->expects($this->once())->method('create')
145144
->willReturn($originalCategory);
146-
$this->categoryMock->expects($this->exactly(2))->method('setUrlKey')->with('url-key')
145+
$this->categoryMock->expects($this->once())->method('setUrlKey')->with('url-key')
147146
->willReturnSelf();
148147

149-
$this->categoryUrlPathGeneratorMock->expects($this->exactly(3))->method('getUrlPath')
148+
$this->categoryUrlPathGeneratorMock->expects($this->any())->method('getUrlPath')
150149
->with($this->categoryMock)->willReturn($urlPath);
151-
$this->categoryMock->expects($this->exactly(3))->method('setUrlPath')->with($urlPath);
150+
$this->categoryMock->expects($this->any())->method('setUrlPath')->with($urlPath);
152151

153152
$this->assertSame(
154153
$this->subjectMock,

0 commit comments

Comments
 (0)