@@ -132,48 +132,27 @@ public function testProcessMediaGallery(): void
132
132
$ newExitingEntriesData ['images ' ],
133
133
$ newExitingEntriesData ['images ' ]
134
134
);
135
-
136
135
$ this ->productMock ->expects ($ this ->any ())
137
136
->method ('getMediaAttributes ' )
138
137
->willReturn (["image " => "imageAttribute " , "small_image " => "small_image_attribute " ]);
139
-
140
138
$ this ->productMock ->method ('hasGalleryAttribute ' )->willReturn (true );
141
-
142
- //setup media attribute backend
143
139
$ mediaTmpPath = '/tmp ' ;
144
140
$ absolutePath = '/a/b/filename.jpg ' ;
145
-
146
141
$ this ->processorMock ->expects ($ this ->once ())->method ('clearMediaAttribute ' )
147
142
->with ($ this ->productMock , ['image ' , 'small_image ' ]);
148
-
149
- $ mediaConfigMock = $ this ->getMockBuilder (Config::class)
150
- ->disableOriginalConstructor ()
151
- ->getMock ();
152
- $ mediaConfigMock ->expects ($ this ->once ())
153
- ->method ('getTmpMediaShortUrl ' )
154
- ->with ($ absolutePath )
143
+ $ mediaConfigMock = $ this ->getMockBuilder (Config::class)->disableOriginalConstructor ()->getMock ();
144
+ $ mediaConfigMock ->expects ($ this ->once ())->method ('getTmpMediaShortUrl ' )->with ($ absolutePath )
155
145
->willReturn ($ mediaTmpPath . $ absolutePath );
156
- $ this ->productMock ->expects ($ this ->once ())
157
- ->method ('getMediaConfig ' )
158
- ->willReturn ($ mediaConfigMock );
159
-
146
+ $ this ->productMock ->expects ($ this ->once ())->method ('getMediaConfig ' )->willReturn ($ mediaConfigMock );
160
147
//verify new entries
161
148
$ contentDataObject = $ this ->getMockBuilder (ImageContent::class)
162
149
->disableOriginalConstructor ()
163
150
->setMethods (null )
164
151
->getMock ();
165
- $ this ->contentFactoryMock ->expects ($ this ->once ())
166
- ->method ('create ' )
167
- ->willReturn ($ contentDataObject );
168
-
169
- $ this ->imageProcessorMock ->expects ($ this ->once ())
170
- ->method ('processImageContent ' )
171
- ->willReturn ($ absolutePath );
172
-
152
+ $ this ->contentFactoryMock ->expects ($ this ->once ())->method ('create ' )->willReturn ($ contentDataObject );
153
+ $ this ->imageProcessorMock ->expects ($ this ->once ())->method ('processImageContent ' )->willReturn ($ absolutePath );
173
154
$ imageFileUri = $ mediaTmpPath . $ absolutePath ;
174
-
175
- $ this ->processorMock ->expects ($ this ->once ())
176
- ->method ('addImage ' )
155
+ $ this ->processorMock ->expects ($ this ->once ())->method ('addImage ' )
177
156
->willReturnCallback (
178
157
function ($ product , $ imageFileUri ) use ($ newEntriesData ) {
179
158
foreach ($ product ['media_gallery ' ]['images ' ] as $ entry ) {
@@ -196,7 +175,6 @@ function ($product, $imageFileUri) use ($newEntriesData) {
196
175
'media_type ' => 'media_type ' ,
197
176
]
198
177
);
199
-
200
178
$ this ->galleryProcessor ->processMediaGallery ($ this ->productMock , $ newEntriesData ['images ' ]);
201
179
}
202
180
}
0 commit comments