@@ -68,7 +68,9 @@ protected function setUp()
68
68
'dataHasChangedFor ' ,
69
69
'isVisibleInSiteVisibility ' ,
70
70
'getIsChangedWebsites ' ,
71
- 'getIsChangedCategories '
71
+ 'getIsChangedCategories ' ,
72
+ 'load ' ,
73
+ 'getStoreId '
72
74
],
73
75
[],
74
76
'' ,
@@ -114,7 +116,9 @@ public function testUrlKeyDataProvider()
114
116
'isChangedCategories ' => false ,
115
117
'visibilityResult ' => true ,
116
118
'expectedDeleteCount ' => 1 ,
117
- 'expectedReplaceCount ' => 1
119
+ 'expectedProdLoadCount ' => 1 ,
120
+ 'expectedReplaceCount ' => 1 ,
121
+
118
122
],
119
123
'no chnages ' => [
120
124
'isChangedUrlKey ' => false ,
@@ -123,6 +127,7 @@ public function testUrlKeyDataProvider()
123
127
'isChangedCategories ' => false ,
124
128
'visibilityResult ' => true ,
125
129
'expectedDeleteCount ' => 0 ,
130
+ 'expectedProdLoadCount ' => 0 ,
126
131
'expectedReplaceCount ' => 0
127
132
],
128
133
'visibility changed ' => [
@@ -132,6 +137,7 @@ public function testUrlKeyDataProvider()
132
137
'isChangedCategories ' => false ,
133
138
'visibilityResult ' => true ,
134
139
'expectedDeleteCount ' => 1 ,
140
+ 'expectedProdLoadCount ' => 1 ,
135
141
'expectedReplaceCount ' => 1
136
142
],
137
143
'websites changed ' => [
@@ -141,6 +147,7 @@ public function testUrlKeyDataProvider()
141
147
'isChangedCategories ' => false ,
142
148
'visibilityResult ' => true ,
143
149
'expectedDeleteCount ' => 1 ,
150
+ 'expectedProdLoadCount ' => 1 ,
144
151
'expectedReplaceCount ' => 1
145
152
],
146
153
'categories changed ' => [
@@ -150,6 +157,7 @@ public function testUrlKeyDataProvider()
150
157
'isChangedCategories ' => true ,
151
158
'visibilityResult ' => true ,
152
159
'expectedDeleteCount ' => 1 ,
160
+ 'expectedProdLoadCount ' => 1 ,
153
161
'expectedReplaceCount ' => 1
154
162
],
155
163
'url changed invisible ' => [
@@ -159,6 +167,7 @@ public function testUrlKeyDataProvider()
159
167
'isChangedCategories ' => false ,
160
168
'visibilityResult ' => false ,
161
169
'expectedDeleteCount ' => 1 ,
170
+ 'expectedProdLoadCount ' => 1 ,
162
171
'expectedReplaceCount ' => 0
163
172
],
164
173
];
@@ -171,6 +180,7 @@ public function testUrlKeyDataProvider()
171
180
* @param bool $isChangedCategories
172
181
* @param bool $visibilityResult
173
182
* @param int $expectedDeleteCount
183
+ * @param int $expectedProdLoadCount
174
184
* @param int $expectedReplaceCount
175
185
*
176
186
* @dataProvider testUrlKeyDataProvider
@@ -182,8 +192,15 @@ public function testExecuteUrlKey(
182
192
$ isChangedCategories ,
183
193
$ visibilityResult ,
184
194
$ expectedDeleteCount ,
195
+ $ expectedProdLoadCount ,
185
196
$ expectedReplaceCount
186
197
) {
198
+ $ this ->product ->expects ($ this ->any ())->method ('getStoreId ' )->will ($ this ->returnValue (12 ));
199
+
200
+ $ this ->product ->expects ($ this ->exactly ($ expectedProdLoadCount ))
201
+ ->method ('load ' )
202
+ ->with ($ this ->product ->getId ());
203
+
187
204
$ this ->product ->expects ($ this ->any ())
188
205
->method ('dataHasChangedFor ' )
189
206
->will ($ this ->returnValueMap (
@@ -205,6 +222,7 @@ public function testExecuteUrlKey(
205
222
UrlRewrite::ENTITY_ID => $ this ->product ->getId (),
206
223
UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE ,
207
224
UrlRewrite::REDIRECT_TYPE => 0 ,
225
+ UrlRewrite::STORE_ID => $ this ->product ->getStoreId ()
208
226
]);
209
227
210
228
$ this ->product ->expects ($ this ->any ())
0 commit comments