55 */
66namespace Magento \Theme \Controller \Adminhtml \System \Design ;
77
8+ use Magento \Framework \App \Config \ScopeConfigInterface ;
89use Magento \Framework \Exception \FileSystemException ;
910use Magento \Framework \Filesystem \DirectoryList ;
1011
1314 */
1415class ThemeControllerTest extends \Magento \TestFramework \TestCase \AbstractBackendController
1516{
17+ /**
18+ * @var ScopeConfigInterface|mixed
19+ */
20+ private $ config ;
21+
22+ /**
23+ * @var string
24+ */
25+ private $ imageAdapter ;
26+
27+ /**
28+ * @inheritDoc
29+ */
30+ protected function setUp (): void
31+ {
32+ parent ::setUp ();
33+
34+ $ this ->config = $ this ->_objectManager ->get (ScopeConfigInterface::class);
35+ $ this ->imageAdapter = $ this ->config ->getValue ('dev/image/default_adapter ' );
36+ }
37+
1638 public function testUploadJsAction ()
1739 {
1840 $ name = 'simple-js-file.js ' ;
@@ -39,14 +61,14 @@ public function testUploadFaviconAction()
3961 $ this ->getRequest ()->setPostValue ('id ' , $ theme ->getId ());
4062 $ this ->dispatch ('backend/admin/design_config_fileUploader/save ' );
4163 $ output = $ this ->getResponse ()->getBody ();
42- if (in_array ('imagick ' , get_loaded_extensions ())) {
43- $ this ->assertStringContainsString ('"error":"false" ' , $ output );
44- $ this ->assertStringContainsString ($ name , $ output );
45- } else {
64+ if (!in_array ('imagick ' , get_loaded_extensions ()) || $ this ->imageAdapter == 'GD2 ' ) {
4665 $ this ->assertStringContainsString (
47- '"error":"Required PHP extension \' Imagick \' was not loaded ." ' ,
66+ '{ "error":"File validation failed ." ' ,
4867 $ output
4968 );
69+ } else {
70+ $ this ->assertStringContainsString ('"error":"false" ' , $ output );
71+ $ this ->assertStringContainsString ($ name , $ output );
5072 }
5173 }
5274 }
0 commit comments