@@ -46,11 +46,6 @@ class ContentTest extends \PHPUnit_Framework_TestCase
46
46
*/
47
47
protected $ imageHelper ;
48
48
49
- /**
50
- * @var \Magento\Framework\View\Asset\Repository|\PHPUnit_Framework_MockObject_MockObject
51
- */
52
- protected $ assetRepo ;
53
-
54
49
/**
55
50
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
56
51
*/
@@ -171,46 +166,33 @@ public function testGetImagesJsonWithException()
171
166
{
172
167
$ this ->imageHelper = $ this ->getMockBuilder ('Magento\Catalog\Helper\Image ' )
173
168
->disableOriginalConstructor ()
174
- ->setMethods (['getDefaultPlaceholderUrl ' , 'getPlaceholder ' ])
175
- ->getMock ();
176
-
177
- $ this ->assetRepo = $ this ->getMockBuilder ('Magento\Framework\View\Asset\Repository ' )
178
- ->disableOriginalConstructor ()
179
- ->setMethods (['createAsset ' , 'getPath ' ])
169
+ ->setMethods (['getDefaultPlaceholderUrl ' ])
180
170
->getMock ();
181
171
182
172
$ this ->objectManager ->setBackwardCompatibleProperty (
183
173
$ this ->content ,
184
174
'imageHelper ' ,
185
- $ this ->imageHelper
186
- );
187
-
188
- $ this ->objectManager ->setBackwardCompatibleProperty (
189
- $ this ->content ,
190
- 'assetRepo ' ,
191
- $ this ->assetRepo
175
+ $ this ->imageHelper
192
176
);
193
177
194
178
$ placeholderUrl = 'url_to_the_placeholder/placeholder.jpg ' ;
195
179
196
- $ sizePlaceholder = ['size ' => 399659 ];
197
-
198
180
$ imagesResult = [
199
181
[
200
182
'value_id ' => '2 ' ,
201
183
'file ' => 'file_2.jpg ' ,
202
184
'media_type ' => 'image ' ,
203
185
'position ' => '0 ' ,
204
186
'url ' => 'url_to_the_placeholder/placeholder.jpg ' ,
205
- 'size ' => 399659
187
+ 'size ' => 0
206
188
],
207
189
[
208
190
'value_id ' => '1 ' ,
209
191
'file ' => 'file_1.jpg ' ,
210
192
'media_type ' => 'image ' ,
211
193
'position ' => '1 ' ,
212
194
'url ' => 'url_to_the_placeholder/placeholder.jpg ' ,
213
- 'size ' => 399659
195
+ 'size ' => 0
214
196
]
215
197
];
216
198
@@ -238,20 +220,15 @@ public function testGetImagesJsonWithException()
238
220
$ this ->mediaConfigMock ->expects ($ this ->any ())->method ('getMediaPath ' );
239
221
$ this ->readMock ->expects ($ this ->any ())->method ('stat ' )->willReturnOnConsecutiveCalls (
240
222
$ this ->throwException (
241
- new \Magento \Framework \Exception \FileSystemException (new \ Magento \ Framework \ Phrase ('test ' ))
223
+ new \Magento \Framework \Exception \FileSystemException (new Phrase ('test ' ))
242
224
),
243
- $ sizePlaceholder ,
244
225
$ this ->throwException (
245
- new \Magento \Framework \Exception \FileSystemException (new \Magento \Framework \Phrase ('test ' ))
246
- ),
247
- $ sizePlaceholder
226
+ new \Magento \Framework \Exception \FileSystemException (new Phrase ('test ' ))
227
+ )
248
228
);
249
229
$ this ->imageHelper ->expects ($ this ->any ())->method ('getDefaultPlaceholderUrl ' )->willReturn ($ placeholderUrl );
250
- $ this ->imageHelper ->expects ($ this ->any ())->method ('getPlaceholder ' );
251
- $ this ->assetRepo ->expects ($ this ->any ())->method ('createAsset ' )->willReturnSelf ();
252
- $ this ->assetRepo ->expects ($ this ->any ())->method ('getPath ' );
253
230
$ this ->jsonEncoderMock ->expects ($ this ->once ())->method ('encode ' )->willReturnCallback ('json_encode ' );
254
231
255
232
$ this ->assertSame (json_encode ($ imagesResult ), $ this ->content ->getImagesJson ());
256
- }
233
+ }
257
234
}
0 commit comments