File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
dev/tests/integration/testsuite/Magento/Framework/File Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,41 @@ public function testUploadFileWithExcessiveFolderName(): void
89
89
$ uploader ->save ($ longDirectoryFolderName );
90
90
}
91
91
92
+ /**
93
+ * Upload file test when `Old Media Gallery` is disabled
94
+ *
95
+ * @magentoConfigFixture system/media_gallery/enabled 1
96
+ * @magentoAppArea adminhtml
97
+ *
98
+ * @return void
99
+ */
100
+ public function testUploadFileToVar (): void
101
+ {
102
+ $ destinationDirectory = $ this ->filesystem ->getDirectoryWrite (DirectoryList::VAR_DIR );
103
+ $ tmpDirectory = $ this ->filesystem ->getDirectoryWrite (DirectoryList::SYS_TMP );
104
+
105
+ $ fileName = 'file.txt ' ;
106
+ $ destinationDir = 'tmp ' ;
107
+ $ filePath = $ tmpDirectory ->getAbsolutePath ($ fileName );
108
+
109
+ $ tmpDirectory ->writeFile ($ fileName , 'some data ' );
110
+
111
+ $ type = [
112
+ 'tmp_name ' => $ filePath ,
113
+ 'name ' => $ fileName ,
114
+ ];
115
+
116
+ $ uploader = $ this ->uploaderFactory ->create (['fileId ' => $ type ]);
117
+ $ uploader ->save ($ destinationDirectory ->getAbsolutePath ($ destinationDir ));
118
+
119
+ // Uploader doesn't save file to local var if remote storage is configured
120
+ if ($ this ->filesystem ->getDirectoryWrite (DirectoryList::MEDIA )->getDriver () instanceof Filesystem \Driver \File) {
121
+ $ this ->assertTrue ($ destinationDirectory ->isFile ($ destinationDir . DIRECTORY_SEPARATOR . $ fileName ));
122
+ } else {
123
+ $ this ->assertFalse ($ destinationDirectory ->isFile ($ destinationDir . DIRECTORY_SEPARATOR . $ fileName ));
124
+ }
125
+ }
126
+
92
127
/**
93
128
* Upload file test when `Old Media Gallery` is disabled
94
129
*
You can’t perform that action at this time.
0 commit comments