@@ -288,35 +288,20 @@ protected function importDataForMediaTest(string $fileName, int $expectedErrors
288
288
'directory ' => $ directory
289
289
]
290
290
);
291
- $ rootDirectory = $ this ->objectManager ->get (TargetDirectory::class)->getDirectoryWrite (DirectoryList::ROOT );
291
+ $ mediaDirectory = $ filesystem ->getDirectoryWrite (DirectoryList::MEDIA );
292
+ $ mediaDirPath = $ this ->getMediaDirPath ($ mediaDirectory );
293
+ $ destDir = $ mediaDirPath . DIRECTORY_SEPARATOR . 'catalog ' . DIRECTORY_SEPARATOR . 'product ' ;
294
+ $ tmpDir = $ mediaDirPath . DIRECTORY_SEPARATOR . 'import ' . DIRECTORY_SEPARATOR . 'images ' ;
295
+ $ mediaDirectory ->create ('catalog ' . DIRECTORY_SEPARATOR . 'product ' );
296
+ $ mediaDirectory ->create ('import ' . DIRECTORY_SEPARATOR . 'images ' );
297
+
292
298
$ this ->_model ->setParameters (
293
299
[
294
300
'behavior ' => \Magento \ImportExport \Model \Import::BEHAVIOR_APPEND ,
295
301
'entity ' => 'catalog_product ' ,
296
- Import::FIELD_NAME_IMG_FILE_DIR => $ this -> getMediaDirPath ( $ rootDirectory ) . '/import '
302
+ Import::FIELD_NAME_IMG_FILE_DIR => $ mediaDirPath . '/import '
297
303
]
298
304
);
299
- $ appParams = \Magento \TestFramework \Helper \Bootstrap::getInstance ()
300
- ->getBootstrap ()
301
- ->getApplication ()
302
- ->getInitParams ()[Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS ];
303
-
304
- if (!$ rootDirectory ->getDriver () instanceof Filesystem \Driver \File) {
305
- $ mediaPath = 'media ' ;
306
- $ varPath = 'media ' ;
307
- } else {
308
- $ mediaPath = $ appParams [DirectoryList::MEDIA ][DirectoryList::PATH ];
309
- $ varPath = $ appParams [DirectoryList::VAR_DIR ][DirectoryList::PATH ];
310
- }
311
- $ destDir = $ rootDirectory ->getRelativePath (
312
- $ mediaPath . DIRECTORY_SEPARATOR . 'catalog ' . DIRECTORY_SEPARATOR . 'product '
313
- );
314
- $ tmpDir = $ rootDirectory ->getRelativePath (
315
- $ varPath . DIRECTORY_SEPARATOR . 'import ' . DIRECTORY_SEPARATOR . 'images '
316
- );
317
- $ rootDirectory ->create ($ destDir );
318
- $ rootDirectory ->create ($ tmpDir );
319
-
320
305
$ uploader = $ this ->_model ->getUploader ();
321
306
$ this ->assertTrue ($ uploader ->setDestDir ($ destDir ));
322
307
$ this ->assertTrue ($ uploader ->setTmpDir ($ tmpDir ));
0 commit comments