File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed
app/code/Magento/Swatches
dev/tests/integration/testsuite/Magento/Swatches/_files Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -176,7 +176,9 @@ public function moveImageFromTmp($file)
176
176
} else {
177
177
$ this ->mediaDirectory ->renameFile (
178
178
$ this ->mediaConfig ->getTmpMediaPath ($ file ),
179
- $ this ->getAttributeSwatchPath ($ destinationFile )
179
+ $ this ->mediaDirectory ->getDriver ()->getRealPathSafety (
180
+ $ this ->getAttributeSwatchPath ($ destinationFile )
181
+ )
180
182
);
181
183
}
182
184
@@ -197,7 +199,7 @@ protected function getUniqueFileName($file)
197
199
$ file
198
200
);
199
201
} else {
200
- $ destFile = rtrim ( dirname ($ file), ' /. ' ) . '/ ' . \Magento \MediaStorage \Model \File \Uploader::getNewFileName (
202
+ $ destFile = dirname ($ file ) . '/ ' . \Magento \MediaStorage \Model \File \Uploader::getNewFileName (
201
203
$ this ->getOriginalFilePath ($ file )
202
204
);
203
205
}
Original file line number Diff line number Diff line change 14
14
use Magento \Framework \Filesystem \Directory \ReadInterface ;
15
15
use Magento \Framework \Filesystem \Directory \Write ;
16
16
use Magento \Framework \Filesystem \Directory \WriteInterface ;
17
+ use Magento \Framework \Filesystem \DriverInterface ;
17
18
use Magento \Framework \Image ;
18
19
use Magento \Framework \Image \Factory ;
19
20
use Magento \Framework \ObjectManagerInterface ;
@@ -174,11 +175,20 @@ public function testMoveImageFromTmp()
174
175
public function testMoveImageFromTmpNoDb ()
175
176
{
176
177
$ this ->fileStorageDbMock ->method ('checkDbUsage ' )->willReturn (false );
177
- $ this ->fileStorageDbMock ->method ('renameFile ' )->willReturnSelf ();
178
178
$ this ->mediaDirectoryMock
179
179
->expects ($ this ->atLeastOnce ())
180
180
->method ('getAbsolutePath ' )
181
181
->willReturn ('attribute/swatch/f/i/file.tmp ' );
182
+ $ this ->mediaDirectoryMock
183
+ ->expects ($ this ->atLeastOnce ())
184
+ ->method ('renameFile ' )
185
+ ->willReturnSelf ();
186
+ $ driver = $ this ->getMockBuilder (DriverInterface::class)
187
+ ->getMockForAbstractClass ();
188
+ $ driver ->method ('getAbsolutePath ' )->willReturn ('file ' );
189
+ $ this ->mediaDirectoryMock
190
+ ->method ('getDriver ' )
191
+ ->willReturn ($ driver );
182
192
$ result = $ this ->mediaHelperObject ->moveImageFromTmp ('file.tmp ' );
183
193
$ this ->assertNotNull ($ result );
184
194
}
Original file line number Diff line number Diff line change 30
30
'image-height ' => 90 ,
31
31
'image-name ' => $ imageName ,
32
32
]);
33
- $ imagePath = $ swatchesMedia ->moveImageFromTmp ($ imageName );
33
+ $ imagePath = substr ( $ swatchesMedia ->moveImageFromTmp ($ imageName), 1 );
34
34
$ swatchesMedia ->generateSwatchVariations ($ imagePath );
35
35
36
36
// Add attribute data
You can’t perform that action at this time.
0 commit comments