@@ -132,48 +132,27 @@ public function testProcessMediaGallery(): void
132132 $ newExitingEntriesData ['images ' ],
133133 $ newExitingEntriesData ['images ' ]
134134 );
135-
136135 $ this ->productMock ->expects ($ this ->any ())
137136 ->method ('getMediaAttributes ' )
138137 ->willReturn (["image " => "imageAttribute " , "small_image " => "small_image_attribute " ]);
139-
140138 $ this ->productMock ->method ('hasGalleryAttribute ' )->willReturn (true );
141-
142- //setup media attribute backend
143139 $ mediaTmpPath = '/tmp ' ;
144140 $ absolutePath = '/a/b/filename.jpg ' ;
145-
146141 $ this ->processorMock ->expects ($ this ->once ())->method ('clearMediaAttribute ' )
147142 ->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 )
155145 ->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 );
160147 //verify new entries
161148 $ contentDataObject = $ this ->getMockBuilder (ImageContent::class)
162149 ->disableOriginalConstructor ()
163150 ->setMethods (null )
164151 ->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 );
173154 $ imageFileUri = $ mediaTmpPath . $ absolutePath ;
174-
175- $ this ->processorMock ->expects ($ this ->once ())
176- ->method ('addImage ' )
155+ $ this ->processorMock ->expects ($ this ->once ())->method ('addImage ' )
177156 ->willReturnCallback (
178157 function ($ product , $ imageFileUri ) use ($ newEntriesData ) {
179158 foreach ($ product ['media_gallery ' ]['images ' ] as $ entry ) {
@@ -196,7 +175,6 @@ function ($product, $imageFileUri) use ($newEntriesData) {
196175 'media_type ' => 'media_type ' ,
197176 ]
198177 );
199-
200178 $ this ->galleryProcessor ->processMediaGallery ($ this ->productMock , $ newEntriesData ['images ' ]);
201179 }
202180}
0 commit comments