@@ -45,7 +45,7 @@ protected function setUp()
45
45
{
46
46
$ this ->productRepositoryMock = $ this ->getMock (\Magento \Catalog \Api \ProductRepositoryInterface::class);
47
47
$ this ->contentValidatorMock = $ this ->getMock (\Magento \Framework \Api \ImageContentValidatorInterface::class);
48
- $ this ->productMock = $ this ->getMock (
48
+ $ this ->productMock = $ this ->getMock (
49
49
\Magento \Catalog \Model \Product::class,
50
50
[
51
51
'setStoreId ' ,
@@ -115,7 +115,7 @@ public function testCreateWithCannotSaveException()
115
115
public function testCreate ()
116
116
{
117
117
$ productSku = 'mediaProduct ' ;
118
- $ entryContentMock = $ this ->getMock (
118
+ $ entryContentMock = $ this ->getMock (
119
119
\Magento \Framework \Api \Data \ImageContentInterface::class
120
120
);
121
121
$ this ->mediaGalleryEntryMock ->expects ($ this ->any ())->method ('getContent ' )->willReturn ($ entryContentMock );
@@ -153,8 +153,8 @@ public function testUpdateWithNonExistingImage()
153
153
$ entryId = 42 ;
154
154
$ this ->productRepositoryMock ->expects ($ this ->once ())->method ('get ' )->with ($ productSku )
155
155
->willReturn ($ this ->productMock );
156
- $ existingEntryMock = $ this ->getMock (
157
- \Magento \Catalog \Api \Data \ProductAttributeMediaGalleryEntryInterface::class
156
+ $ existingEntryMock = $ this ->getMock (
157
+ \Magento \Catalog \Api \Data \ProductAttributeMediaGalleryEntryInterface::class
158
158
);
159
159
$ existingEntryMock ->expects ($ this ->once ())->method ('getId ' )->willReturn (43 );
160
160
$ this ->productMock ->expects ($ this ->once ())->method ('getMediaGalleryEntries ' )
@@ -174,8 +174,8 @@ public function testUpdateWithCannotSaveException()
174
174
$ entryId = 42 ;
175
175
$ this ->productRepositoryMock ->expects ($ this ->once ())->method ('get ' )->with ($ productSku )
176
176
->willReturn ($ this ->productMock );
177
- $ existingEntryMock = $ this ->getMock (
178
- \Magento \Catalog \Api \Data \ProductAttributeMediaGalleryEntryInterface::class
177
+ $ existingEntryMock = $ this ->getMock (
178
+ \Magento \Catalog \Api \Data \ProductAttributeMediaGalleryEntryInterface::class
179
179
);
180
180
$ existingEntryMock ->expects ($ this ->once ())->method ('getId ' )->willReturn ($ entryId );
181
181
$ this ->productMock ->expects ($ this ->once ())->method ('getMediaGalleryEntries ' )
@@ -193,13 +193,15 @@ public function testUpdate()
193
193
$ entryId = 42 ;
194
194
$ this ->productRepositoryMock ->expects ($ this ->once ())->method ('get ' )->with ($ productSku )
195
195
->willReturn ($ this ->productMock );
196
- $ existingEntryMock = $ this ->getMock (
197
- \Magento \Catalog \Api \Data \ProductAttributeMediaGalleryEntryInterface::class
196
+ $ existingEntryMock = $ this ->getMock (
197
+ \Magento \Catalog \Api \Data \ProductAttributeMediaGalleryEntryInterface::class
198
198
);
199
199
$ existingEntryMock ->expects ($ this ->once ())->method ('getId ' )->willReturn ($ entryId );
200
200
$ this ->productMock ->expects ($ this ->once ())->method ('getMediaGalleryEntries ' )
201
201
->willReturn ([$ existingEntryMock ]);
202
202
$ entryMock ->expects ($ this ->once ())->method ('getId ' )->willReturn ($ entryId );
203
+ $ entryMock ->expects ($ this ->once ())->method ('getFile ' )->willReturn ("base64 " );
204
+ $ entryMock ->expects ($ this ->once ())->method ('setId ' )->with (null );
203
205
204
206
$ this ->productMock ->expects ($ this ->once ())->method ('setMediaGalleryEntries ' )
205
207
->willReturn ([$ entryMock ]);
@@ -217,8 +219,8 @@ public function testRemoveWithNonExistingImage()
217
219
$ entryId = 42 ;
218
220
$ this ->productRepositoryMock ->expects ($ this ->once ())->method ('get ' )->with ($ productSku )
219
221
->willReturn ($ this ->productMock );
220
- $ existingEntryMock = $ this ->getMock (
221
- \Magento \Catalog \Api \Data \ProductAttributeMediaGalleryEntryInterface::class
222
+ $ existingEntryMock = $ this ->getMock (
223
+ \Magento \Catalog \Api \Data \ProductAttributeMediaGalleryEntryInterface::class
222
224
);
223
225
$ existingEntryMock ->expects ($ this ->once ())->method ('getId ' )->willReturn (43 );
224
226
$ this ->productMock ->expects ($ this ->once ())->method ('getMediaGalleryEntries ' )
@@ -232,8 +234,8 @@ public function testRemove()
232
234
$ entryId = 42 ;
233
235
$ this ->productRepositoryMock ->expects ($ this ->once ())->method ('get ' )->with ($ productSku )
234
236
->willReturn ($ this ->productMock );
235
- $ existingEntryMock = $ this ->getMock (
236
- \Magento \Catalog \Api \Data \ProductAttributeMediaGalleryEntryInterface::class
237
+ $ existingEntryMock = $ this ->getMock (
238
+ \Magento \Catalog \Api \Data \ProductAttributeMediaGalleryEntryInterface::class
237
239
);
238
240
$ existingEntryMock ->expects ($ this ->once ())->method ('getId ' )->willReturn (42 );
239
241
$ this ->productMock ->expects ($ this ->once ())->method ('getMediaGalleryEntries ' )
@@ -267,8 +269,8 @@ public function testGetWithNonExistingImage()
267
269
$ imageId = 43 ;
268
270
$ this ->productRepositoryMock ->expects ($ this ->once ())->method ('get ' )->with ($ productSku )
269
271
->willReturn ($ this ->productMock );
270
- $ existingEntryMock = $ this ->getMock (
271
- \Magento \Catalog \Api \Data \ProductAttributeMediaGalleryEntryInterface::class
272
+ $ existingEntryMock = $ this ->getMock (
273
+ \Magento \Catalog \Api \Data \ProductAttributeMediaGalleryEntryInterface::class
272
274
);
273
275
$ existingEntryMock ->expects ($ this ->once ())->method ('getId ' )->willReturn (44 );
274
276
$ this ->productMock ->expects ($ this ->once ())->method ('getMediaGalleryEntries ' )
@@ -282,8 +284,8 @@ public function testGet()
282
284
$ imageId = 42 ;
283
285
$ this ->productRepositoryMock ->expects ($ this ->once ())->method ('get ' )->with ($ productSku )
284
286
->willReturn ($ this ->productMock );
285
- $ existingEntryMock = $ this ->getMock (
286
- \Magento \Catalog \Api \Data \ProductAttributeMediaGalleryEntryInterface::class
287
+ $ existingEntryMock = $ this ->getMock (
288
+ \Magento \Catalog \Api \Data \ProductAttributeMediaGalleryEntryInterface::class
287
289
);
288
290
$ existingEntryMock ->expects ($ this ->once ())->method ('getId ' )->willReturn (42 );
289
291
$ this ->productMock ->expects ($ this ->once ())->method ('getMediaGalleryEntries ' )
0 commit comments