@@ -120,9 +120,6 @@ public function testGenerationForGlobalScope()
120
120
$ product ->expects ($ this ->any ())->method ('getStoreIds ' )->will ($ this ->returnValue ([1 ]));
121
121
$ this ->storeViewService ->expects ($ this ->once ())->method ('doesEntityHaveOverriddenUrlKeyForStore ' )
122
122
->will ($ this ->returnValue (false ));
123
- $ this ->categoryMock ->expects ($ this ->once ())
124
- ->method ('getParentId ' )
125
- ->willReturn (2 );
126
123
$ this ->initObjectRegistryFactory ([]);
127
124
$ canonical = new \Magento \UrlRewrite \Service \V1 \Data \UrlRewrite ([], $ this ->serializer );
128
125
$ canonical ->setRequestPath ('category-1 ' )
@@ -161,14 +158,12 @@ public function testGenerationForGlobalScope()
161
158
public function testGenerationForSpecificStore ()
162
159
{
163
160
$ storeRootCategoryId = 2 ;
164
- $ parent_id = 3 ;
165
161
$ category_id = 4 ;
166
162
$ product = $ this ->createMock (\Magento \Catalog \Model \Product::class);
167
163
$ product ->expects ($ this ->any ())->method ('getStoreId ' )->will ($ this ->returnValue (1 ));
168
164
$ product ->expects ($ this ->never ())->method ('getStoreIds ' );
169
165
$ this ->categoryMock ->expects ($ this ->any ())->method ('getParentIds ' )
170
166
->will ($ this ->returnValue (['root-id ' , $ storeRootCategoryId ]));
171
- $ this ->categoryMock ->expects ($ this ->any ())->method ('getParentId ' )->will ($ this ->returnValue ($ parent_id ));
172
167
$ this ->categoryMock ->expects ($ this ->any ())->method ('getId ' )->will ($ this ->returnValue ($ category_id ));
173
168
$ this ->initObjectRegistryFactory ([$ this ->categoryMock ]);
174
169
$ canonical = new \Magento \UrlRewrite \Service \V1 \Data \UrlRewrite ([], $ this ->serializer );
@@ -219,15 +214,13 @@ protected function initObjectRegistryFactory($entities)
219
214
/**
220
215
* Test the possibility of url rewrite generation.
221
216
*
222
- * @param int $parentId
223
217
* @param array $parentIds
224
218
* @param bool $expectedResult
225
219
* @dataProvider isCategoryProperForGeneratingDataProvider
226
220
*/
227
- public function testIsCategoryProperForGenerating ($ parentId , $ parentIds , $ expectedResult )
221
+ public function testIsCategoryProperForGenerating ($ parentIds , $ expectedResult )
228
222
{
229
223
$ storeId = 1 ;
230
- $ this ->categoryMock ->expects (self ::any ())->method ('getParentId ' )->willReturn ($ parentId );
231
224
$ this ->categoryMock ->expects (self ::any ())->method ('getParentIds ' )->willReturn ($ parentIds );
232
225
$ result = $ this ->productScopeGenerator ->isCategoryProperForGenerating (
233
226
$ this ->categoryMock ,
@@ -247,10 +240,10 @@ public function testIsCategoryProperForGenerating($parentId, $parentIds, $expect
247
240
public function isCategoryProperForGeneratingDataProvider ()
248
241
{
249
242
return [
250
- [' 0 ' , ['0 ' ], false ],
251
- [' 1 ' , ['1 ' ], false ],
252
- [' 2 ' , ['1 ' , '2 ' ], true ],
253
- [' 2 ' , ['1 ' , '3 ' ], false ],
243
+ [['0 ' ], false ],
244
+ [['1 ' ], false ],
245
+ [['1 ' , '2 ' ], true ],
246
+ [['1 ' , '3 ' ], false ],
254
247
];
255
248
}
256
249
}
0 commit comments