File tree Expand file tree Collapse file tree 3 files changed +18
-11
lines changed
dev/tests/integration/testsuite/Magento/Catalog
Model/Product/Option/Type/File Expand file tree Collapse file tree 3 files changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ class ValidatorInfoTest extends \PHPUnit_Framework_TestCase
16
16
protected $ model ;
17
17
18
18
/**
19
- * @var \Magento\Framework\ObjectManager
19
+ * @var \Magento\Framework\ObjectManagerInterface
20
20
*/
21
21
protected $ objectManager ;
22
22
@@ -164,11 +164,13 @@ protected function getProductOption(array $options = [])
164
164
*/
165
165
protected function getOptionValue ()
166
166
{
167
- $ file = 'var/tmp/magento_small_image.jpg ' ;
167
+ /** @var \Magento\Catalog\Model\Product\Media\Config $config */
168
+ $ config = $ this ->objectManager ->get ('Magento\Catalog\Model\Product\Media\Config ' );
169
+ $ file = $ config ->getBaseTmpMediaPath () . '/magento_small_image.jpg ' ;
168
170
169
- /** @var \Magento\Framework\App\ Filesystem $filesystem */
171
+ /** @var \Magento\Framework\Filesystem $filesystem */
170
172
$ filesystem = $ this ->objectManager ->get ('Magento\Framework\Filesystem ' );
171
- $ tmpDirectory = $ filesystem ->getDirectoryWrite (\Magento \Framework \App \Filesystem \DirectoryList::ROOT );
173
+ $ tmpDirectory = $ filesystem ->getDirectoryRead (\Magento \Framework \App \Filesystem \DirectoryList::MEDIA );
172
174
$ filePath = $ tmpDirectory ->getAbsolutePath ($ file );
173
175
174
176
return [
Original file line number Diff line number Diff line change 7
7
$ objectManager = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ();
8
8
9
9
/** @var \Magento\Framework\Filesystem $filesystem */
10
- $ filesystem = $ objectManager ->create ('Magento\Framework\Filesystem ' );
10
+ $ filesystem = $ objectManager ->get ('Magento\Framework\Filesystem ' );
11
+
12
+ /** @var Magento\Catalog\Model\Product\Media\Config $config */
13
+ $ config = $ objectManager ->get ('Magento\Catalog\Model\Product\Media\Config ' );
11
14
12
15
/** @var $tmpDirectory \Magento\Framework\Filesystem\Directory\WriteInterface */
13
- $ tmpDirectory = $ filesystem ->getDirectoryWrite (\Magento \Framework \App \Filesystem \DirectoryList::ROOT );
14
- $ tmpDirectory ->create (' var/tmp ' );
16
+ $ tmpDirectory = $ filesystem ->getDirectoryWrite (\Magento \Framework \App \Filesystem \DirectoryList::MEDIA );
17
+ $ tmpDirectory ->create ($ config -> getBaseTmpMediaPath () );
15
18
16
- $ targetTmpFilePath = $ tmpDirectory ->getAbsolutePath (' var/tmp /magento_small_image.jpg ' );
19
+ $ targetTmpFilePath = $ tmpDirectory ->getAbsolutePath ($ config -> getBaseTmpMediaPath () . ' /magento_small_image.jpg ' );
17
20
copy (__DIR__ . '/magento_small_image.jpg ' , $ targetTmpFilePath );
18
21
// Copying the image to target dir is not necessary because during product save, it will be moved there from tmp dir
Original file line number Diff line number Diff line change 9
9
/** @var \Magento\Framework\Filesystem $filesystem */
10
10
$ filesystem = $ objectManager ->create ('Magento\Framework\Filesystem ' );
11
11
12
+ /** @var Magento\Catalog\Model\Product\Media\Config $config */
13
+ $ config = $ objectManager ->get ('Magento\Catalog\Model\Product\Media\Config ' );
14
+
12
15
/** @var $tmpDirectory \Magento\Framework\Filesystem\Directory\WriteInterface */
13
- $ tmpDirectory = $ filesystem ->getDirectoryWrite (\Magento \Framework \App \Filesystem \DirectoryList::TMP );
14
- $ tmpDirectory ->create ($ tmpDirectory ->getAbsolutePath ());
16
+ $ tmpDirectory = $ filesystem ->getDirectoryRead (\Magento \Framework \App \Filesystem \DirectoryList::MEDIA );
15
17
16
- $ targetTmpFilePath = $ tmpDirectory ->getAbsolutePath (' magento_small_image.jpg ' );
18
+ $ targetTmpFilePath = $ tmpDirectory ->getAbsolutePath ($ config -> getBaseTmpMediaPath () . ' / magento_small_image.jpg ' );
17
19
if (file_exists ($ targetTmpFilePath )) {
18
20
unlink ($ targetTmpFilePath );
19
21
}
You can’t perform that action at this time.
0 commit comments