Skip to content

Commit 69198c7

Browse files
author
Ivan Gavryshko
committed
MAGETWO-45482: Store front category url doesn't include all its parents
- fixed unittest
1 parent ef8515b commit 69198c7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/CategoryUrlPathGeneratorTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ public function getUrlPathDataProvider()
9696
$noGenerationLevel = CategoryUrlPathGenerator::MINIMAL_CATEGORY_LEVEL_FOR_PROCESSING - 1;
9797
return [
9898
[Category::TREE_ROOT_ID, 'url-path', $noGenerationLevel, '', false, false, ''],
99-
['parent_id', 'url-path', $noGenerationLevel, '', false, false, 'url-path'],
100-
['parent_id', 'url-path', $noGenerationLevel, 'url-key', true, false, 'url-key'],
101-
['parent_id', 'url-path', $noGenerationLevel, 'url-key', false, true, 'url-key'],
99+
[13, 'url-path', $noGenerationLevel, '', false, false, 'url-path'],
100+
[13, 'url-path', $noGenerationLevel, 'url-key', true, false, 'url-key'],
101+
[13, 'url-path', $noGenerationLevel, 'url-key', false, true, 'url-key'],
102102
];
103103
}
104104

@@ -110,7 +110,7 @@ public function getUrlPathWithParentDataProvider()
110110
$requireGenerationLevel = CategoryUrlPathGenerator::MINIMAL_CATEGORY_LEVEL_FOR_PROCESSING;
111111
$noGenerationLevel = CategoryUrlPathGenerator::MINIMAL_CATEGORY_LEVEL_FOR_PROCESSING - 1;
112112
return [
113-
['url-key', false, $requireGenerationLevel, 'parent_id', 'parent-path', 'parent-path/url-key'],
113+
['url-key', false, $requireGenerationLevel, 13, 'parent-path', 'parent-path/url-key'],
114114
['url-key', false, $requireGenerationLevel, Category::TREE_ROOT_ID, null, 'url-key'],
115115
['url-key', true, $noGenerationLevel, Category::TREE_ROOT_ID, null, 'url-key'],
116116
];
@@ -136,7 +136,7 @@ public function testGetUrlPathWithParent(
136136
$urlPath = null;
137137
$parentLevel = CategoryUrlPathGenerator::MINIMAL_CATEGORY_LEVEL_FOR_PROCESSING - 1;
138138
$this->category->expects($this->any())->method('getParentId')
139-
->will($this->returnValue('parent_id'));
139+
->will($this->returnValue(13));
140140
$this->category->expects($this->any())->method('getLevel')
141141
->will($this->returnValue($level));
142142
$this->category->expects($this->any())->method('getUrlPath')->will($this->returnValue($urlPath));
@@ -152,7 +152,7 @@ public function testGetUrlPathWithParent(
152152
$parentCategory->expects($this->any())->method('dataHasChangedFor')
153153
->will($this->returnValueMap([['url_key', false], ['path_ids', false]]));
154154

155-
$this->categoryRepository->expects($this->any())->method('get')->with('parent_id')
155+
$this->categoryRepository->expects($this->any())->method('get')->with(13)
156156
->will($this->returnValue($parentCategory));
157157

158158
$this->assertEquals($result, $this->categoryUrlPathGenerator->getUrlPath($this->category));
@@ -205,7 +205,7 @@ public function testGetUrlPathWithSuffixWithoutStore()
205205
$result = 'url-path.html';
206206

207207
$this->category->expects($this->any())->method('getStoreId')->will($this->returnValue($storeId));
208-
$this->category->expects($this->once())->method('getParentId')->will($this->returnValue('parent_id'));
208+
$this->category->expects($this->once())->method('getParentId')->will($this->returnValue(2));
209209
$this->category->expects($this->once())->method('getUrlPath')->will($this->returnValue($urlPath));
210210
$this->category->expects($this->exactly(2))->method('dataHasChangedFor')
211211
->will($this->returnValueMap([['url_key', false], ['path_ids', false]]));

0 commit comments

Comments
 (0)