Skip to content

Commit 3c37373

Browse files
author
Oleksandr Iegorov
committed
MAGETWO-61549: Use default URL Key
1 parent 506f282 commit 3c37373

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

app/code/Magento/CatalogUrlRewrite/Test/Unit/Observer/CategoryUrlPathAutogeneratorObserverTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function testSetCategoryUrlAndCategoryPath()
105105
$this->category->expects($this->once())->method('setUrlKey')->with('urk_key')->willReturnSelf();
106106
$this->categoryUrlPathGenerator->expects($this->once())->method('getUrlPath')->willReturn('url_path');
107107
$this->category->expects($this->once())->method('setUrlPath')->with('url_path')->willReturnSelf();
108-
$this->category->expects($this->atLeastOnce())->method('isObjectNew')->willReturn(true);
108+
$this->category->expects($this->exactly(2))->method('isObjectNew')->willReturn(true);
109109

110110
$this->categoryUrlPathAutogeneratorObserver->execute($this->observer);
111111
}
@@ -149,7 +149,7 @@ public function testUrlKeyAndUrlPathUpdating()
149149
$this->category->expects($this->once())->method('setUrlKey')->with('url_key')->willReturnSelf();
150150
$this->category->expects($this->once())->method('setUrlPath')->with('url_path')->willReturnSelf();
151151
// break code execution
152-
$this->category->expects($this->atLeastOnce())->method('isObjectNew')->willReturn(true);
152+
$this->category->expects($this->exactly(2))->method('isObjectNew')->willReturn(true);
153153

154154
$this->categoryUrlPathAutogeneratorObserver->execute($this->observer);
155155
}
@@ -163,7 +163,7 @@ public function testUrlPathAttributeNoUpdatingIfCategoryIsNew()
163163
$this->category->expects($this->any())->method('setUrlKey')->willReturnSelf();
164164
$this->category->expects($this->any())->method('setUrlPath')->willReturnSelf();
165165

166-
$this->category->expects($this->atLeastOnce())->method('isObjectNew')->willReturn(true);
166+
$this->category->expects($this->exactly(2))->method('isObjectNew')->willReturn(true);
167167
$this->categoryResource->expects($this->never())->method('saveAttribute');
168168

169169
$this->categoryUrlPathAutogeneratorObserver->execute($this->observer);
@@ -177,7 +177,7 @@ public function testUrlPathAttributeUpdating()
177177
$this->category->expects($this->any())->method('getUrlKey')->willReturn('not_formatted_url_key');
178178
$this->category->expects($this->any())->method('setUrlKey')->willReturnSelf();
179179
$this->category->expects($this->any())->method('setUrlPath')->willReturnSelf();
180-
$this->category->expects($this->atLeastOnce())->method('isObjectNew')->willReturn(false);
180+
$this->category->expects($this->exactly(2))->method('isObjectNew')->willReturn(false);
181181

182182
$this->categoryResource->expects($this->once())->method('saveAttribute')->with($this->category, 'url_path');
183183

@@ -197,7 +197,7 @@ public function testChildrenUrlPathAttributeNoUpdatingIfParentUrlPathIsNotChange
197197
$this->category->expects($this->any())->method('getUrlKey')->willReturn('not_formatted_url_key');
198198
$this->category->expects($this->any())->method('setUrlKey')->willReturnSelf();
199199
$this->category->expects($this->any())->method('setUrlPath')->willReturnSelf();
200-
$this->category->expects($this->atLeastOnce())->method('isObjectNew')->willReturn(false);
200+
$this->category->expects($this->exactly(2))->method('isObjectNew')->willReturn(false);
201201
// break code execution
202202
$this->category->expects($this->once())->method('dataHasChangedFor')->with('url_path')->willReturn(false);
203203

@@ -212,7 +212,7 @@ public function testChildrenUrlPathAttributeUpdatingForSpecificStore()
212212
$this->category->expects($this->any())->method('getUrlKey')->willReturn('not_formatted_url_key');
213213
$this->category->expects($this->any())->method('setUrlKey')->willReturnSelf();
214214
$this->category->expects($this->any())->method('setUrlPath')->willReturnSelf();
215-
$this->category->expects($this->atLeastOnce())->method('isObjectNew')->willReturn(false);
215+
$this->category->expects($this->exactly(2))->method('isObjectNew')->willReturn(false);
216216
$this->category->expects($this->any())->method('dataHasChangedFor')->willReturn(true);
217217
// only for specific store
218218
$this->category->expects($this->atLeastOnce())->method('getStoreId')->willReturn(1);

0 commit comments

Comments
 (0)