File tree 4 files changed +90
-0
lines changed
Backend/Test/Mftf/ActionGroup
Controller/Adminhtml/Media
4 files changed +90
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <!--
3
+ /**
4
+ * Copyright © Magento, Inc. All rights reserved.
5
+ * See COPYING.txt for license details.
6
+ */
7
+ -->
8
+
9
+ <actionGroups xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
10
+ xsi : noNamespaceSchemaLocation =" urn:magento:mftf:Test/etc/actionGroupSchema.xsd" >
11
+ <actionGroup name =" AssertAdminPageIs404ActionGroup" >
12
+ <annotations >
13
+ <description >Validates that the '404 Error' message is present in the current Admin Page Header.</description >
14
+ </annotations >
15
+
16
+ <see userInput =" 404 Error" selector =" {{AdminHeaderSection.pageHeading}}" stepKey =" see404PageHeading" />
17
+ </actionGroup >
18
+ </actionGroups >
Original file line number Diff line number Diff line change 12
12
use Magento \Framework \App \Action \HttpGetActionInterface ;
13
13
use Magento \Framework \Controller \ResultFactory ;
14
14
use Magento \Framework \Controller \ResultInterface ;
15
+ use Magento \MediaContentApi \Model \Config ;
16
+ use Magento \Backend \App \Action \Context ;
17
+ use Magento \Backend \Model \View \Result \Forward ;
15
18
16
19
/**
17
20
* Controller serving the media gallery content
@@ -20,13 +23,39 @@ class Index extends Action implements HttpGetActionInterface
20
23
{
21
24
public const ADMIN_RESOURCE = 'Magento_Cms::media_gallery ' ;
22
25
26
+ /**
27
+ * @var Config
28
+ */
29
+ private $ config ;
30
+
31
+ /**
32
+ * Index constructor.
33
+ * @param Context $context
34
+ * @param Config $config
35
+ */
36
+ public function __construct (
37
+ Context $ context ,
38
+ Config $ config
39
+ ) {
40
+ parent ::__construct ($ context );
41
+ $ this ->config = $ config ;
42
+ }
43
+
23
44
/**
24
45
* Get the media gallery layout
25
46
*
26
47
* @return ResultInterface
27
48
*/
28
49
public function execute (): ResultInterface
29
50
{
51
+ if (!$ this ->config ->isEnabled ()) {
52
+ /** @var Forward $resultForward */
53
+ $ resultForward = $ this ->resultFactory ->create (ResultFactory::TYPE_FORWARD );
54
+ $ resultForward ->forward ('noroute ' );
55
+
56
+ return $ resultForward ;
57
+ }
58
+
30
59
/** @var Page $resultPage */
31
60
$ resultPage = $ this ->resultFactory ->create (ResultFactory::TYPE_PAGE );
32
61
$ resultPage ->setActiveMenu ('Magento_MediaGalleryUi::media_gallery ' )
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <!--
3
+ /**
4
+ * Copyright © Magento, Inc. All rights reserved.
5
+ * See COPYING.txt for license details.
6
+ */
7
+ -->
8
+
9
+ <suites xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
10
+ xsi : noNamespaceSchemaLocation =" urn:magento:mftf:Suite/etc/suiteSchema.xsd" >
11
+ <suite name =" MediaGalleryUiDisabledSuite" >
12
+ <include >
13
+ <group name =" media_gallery_ui_disabled" />
14
+ </include >
15
+ </suite >
16
+ </suites >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <!--
3
+ /**
4
+ * Copyright © Magento, Inc. All rights reserved.
5
+ * See COPYING.txt for license details.
6
+ */
7
+ -->
8
+
9
+ <tests xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:mftf:Test/etc/testSchema.xsd" >
10
+ <test name =" AdminStandaloneMediaGalleryDisabledTest" >
11
+ <annotations >
12
+ <features value =" MediaGallery" />
13
+ <useCaseId value =" https://github.com/magento/adobe-stock-integration/issues/1760" />
14
+ <title value =" Standalone Media Gallery Page should return 404 if Media Gallery is disabled" />
15
+ <stories value =" #1760 Media Gallery Page opened successfully if Enhanced Media Gallery disabled" />
16
+ <testCaseId value =" https://studio.cucumber.io/projects/131313/test-plan/folders/1337102/scenarios/5106786" />
17
+ <description value =" Standalone Media Gallery Page should return 404 if Media Gallery is disabled" />
18
+ <severity value =" CRITICAL" />
19
+ <group value =" media_gallery_ui_disabled" />
20
+ </annotations >
21
+ <before >
22
+ <actionGroup ref =" AdminLoginActionGroup" stepKey =" loginAsAdmin" />
23
+ </before >
24
+ <actionGroup ref =" AdminOpenStandaloneMediaGalleryActionGroup" stepKey =" openStandaloneMediaGallery" />
25
+ <actionGroup ref =" AssertAdminPageIs404ActionGroup" stepKey =" see404Page" />
26
+ </test >
27
+ </tests >
You can’t perform that action at this time.
0 commit comments