5
5
*/
6
6
namespace Magento \Theme \Controller \Adminhtml \System \Design ;
7
7
8
+ use Magento \Framework \App \Config \ScopeConfigInterface ;
8
9
use Magento \Framework \Exception \FileSystemException ;
9
10
use Magento \Framework \Filesystem \DirectoryList ;
10
11
13
14
*/
14
15
class ThemeControllerTest extends \Magento \TestFramework \TestCase \AbstractBackendController
15
16
{
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
+
16
38
public function testUploadJsAction ()
17
39
{
18
40
$ name = 'simple-js-file.js ' ;
@@ -39,14 +61,14 @@ public function testUploadFaviconAction()
39
61
$ this ->getRequest ()->setPostValue ('id ' , $ theme ->getId ());
40
62
$ this ->dispatch ('backend/admin/design_config_fileUploader/save ' );
41
63
$ 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 ' ) {
46
65
$ this ->assertStringContainsString (
47
- '"error":"Required PHP extension \' Imagick \' was not loaded ." ' ,
66
+ '{ "error":"File validation failed ." ' ,
48
67
$ output
49
68
);
69
+ } else {
70
+ $ this ->assertStringContainsString ('"error":"false" ' , $ output );
71
+ $ this ->assertStringContainsString ($ name , $ output );
50
72
}
51
73
}
52
74
}
0 commit comments