Skip to content

Commit 0994c44

Browse files
committed
magento/adobe-stock-integration#1760: Media Gallery page and Category grid page opened successfully if "Enhanced Media Gallery" disabled - revert category grid no route redirect when media gallery is disabled, MFTF test coverage
1 parent afe499d commit 0994c44

File tree

4 files changed

+47
-31
lines changed

4 files changed

+47
-31
lines changed

app/code/Magento/MediaGalleryCatalogUi/Controller/Adminhtml/Category/Index.php

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@
88
namespace Magento\MediaGalleryCatalogUi\Controller\Adminhtml\Category;
99

1010
use Magento\Backend\App\Action;
11-
use Magento\Backend\App\Action\Context;
1211
use Magento\Backend\Model\View\Result\Page;
13-
use Magento\Backend\Model\View\Result\Forward;
1412
use Magento\Framework\App\Action\HttpGetActionInterface;
1513
use Magento\Framework\Controller\ResultFactory;
1614
use Magento\Framework\Controller\ResultInterface;
17-
use Magento\MediaContentApi\Model\Config;
1815

1916
/**
2017
* Controller serving the media gallery content
@@ -23,39 +20,13 @@ class Index extends Action implements HttpGetActionInterface
2320
{
2421
public const ADMIN_RESOURCE = 'Magento_Cms::media_gallery';
2522

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-
4423
/**
4524
* Get the media gallery layout
4625
*
4726
* @return ResultInterface
4827
*/
4928
public function execute(): ResultInterface
5029
{
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-
5930
/** @var Page $resultPage */
6031
$resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
6132
$resultPage->getConfig()->getTitle()->prepend(__('Categories'));

app/code/Magento/MediaGalleryCatalogUi/composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
"magento/module-backend": "*",
99
"magento/module-catalog": "*",
1010
"magento/module-store": "*",
11-
"magento/module-ui": "*",
12-
"magento/module-media-content-api": "*"
11+
"magento/module-ui": "*"
1312
},
1413
"type": "magento2-module",
1514
"license": [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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="AssertAdminStandaloneMediaGalleryPageIs404ActionGroup">
12+
<annotations>
13+
<description>Validates that the '404 Error' message is present and correct in the Admin Standalone Media Gallery Page Header.</description>
14+
</annotations>
15+
16+
<see userInput="404 Error" selector="{{AdminHeaderSection.pageHeading}}" stepKey="see404PageHeading"/>
17+
</actionGroup>
18+
</actionGroups>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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="AdminMediaGalleryDisabledPageTest">
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"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
23+
<actionGroup ref="AdminMediaGalleryEnhancedEnableActionGroup" stepKey="disableEnhancedMediaGallery"/>
24+
<actionGroup ref="AdminOpenStandaloneMediaGalleryActionGroup" stepKey="openStandaloneMediaGallery"/>
25+
</before>
26+
<actionGroup ref="AssertAdminStandaloneMediaGalleryPageIs404ActionGroup" stepKey="see404Page"/>
27+
</test>
28+
</tests>

0 commit comments

Comments
 (0)