Skip to content

Commit 3f515cb

Browse files
ENGCOM-6190: Resolve 'Enable Single-Store Mode' is 'Yes' but the create New Rating has store view title issue25060 #25061
- Merge Pull Request #25061 from edenduong/magento2:2.3-bugfix/single_store_mode_rating_issue25060 - Merged commits: 1. 2867668 2. 061b747 3. 6874b31
2 parents 68d2137 + 6874b31 commit 3f515cb

8 files changed

+152
-6
lines changed

app/code/Magento/Review/Block/Adminhtml/Rating/Edit/Tab/Form.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,16 @@ protected function addRatingFieldset()
111111
]
112112
);
113113

114-
foreach ($this->systemStore->getStoreCollection() as $store) {
115-
$this->getFieldset('rating_form')->addField(
116-
'rating_code_' . $store->getId(),
117-
'text',
118-
['label' => $store->getName(), 'name' => 'rating_codes[' . $store->getId() . ']']
119-
);
114+
if (!$this->_storeManager->isSingleStoreMode()) {
115+
foreach ($this->systemStore->getStoreCollection() as $store) {
116+
$this->getFieldset('rating_form')->addField(
117+
'rating_code_' . $store->getId(),
118+
'text',
119+
['label' => $store->getName(), 'name' => 'rating_codes[' . $store->getId() . ']']
120+
);
121+
}
120122
}
123+
121124
$this->setRatingData();
122125
}
123126

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminAssertStoreViewRatingTitleWhenSingleStoreModeIsNoActionGroup">
11+
<annotations>
12+
<description>If Single Store Mode is disabled, default store view title label should be displayed.</description>
13+
</annotations>
14+
<seeElement selector="{{AdminEditAndNewRatingSection.defaultStoreViewTitleLabel}}" stepKey="seeLabel"/>
15+
<seeElement selector="{{AdminEditAndNewRatingSection.defaultStoreViewTitleInput}}" stepKey="seeInput"/>
16+
</actionGroup>
17+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminAssertStoreViewRatingTitleWhenSingleStoreModeIsYesActionGroup">
11+
<annotations>
12+
<description>If Single Store Mode is enabled, default store view title label should not be displayed.</description>
13+
</annotations>
14+
<dontSeeElement selector="{{AdminEditAndNewRatingSection.defaultStoreViewTitleLabel}}" stepKey="dontSeeLabel"/>
15+
<dontSeeElement selector="{{AdminEditAndNewRatingSection.defaultStoreViewTitleInput}}" stepKey="dontSeeInput"/>
16+
</actionGroup>
17+
</actionGroups>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminNavigateToNewRatingFormActionGroup">
11+
<annotations>
12+
<description>Open New Rating Form</description>
13+
</annotations>
14+
<amOnPage url="{{AdminNewRatingPage.url}}" stepKey="amOnUrlNewRatingPage"/>
15+
<waitForPageLoad stepKey="waitForNewRatingPage"/>
16+
</actionGroup>
17+
</actionGroups>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11+
<page name="AdminNewRatingPage" url="review/rating/new/" area="admin" module="Review">
12+
<section name="AdminEditAndNewRatingSection"/>
13+
</page>
14+
</pages>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminEditAndNewRatingSection">
12+
<element name="defaultStoreViewTitleLabel" type="text" selector=".field-rating_code_1 label"/>
13+
<element name="defaultStoreViewTitleInput" type="input" selector=".field-rating_code_1 input"/>
14+
</section>
15+
</sections>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminVerifyNewRatingFormSingleStoreModeNoTest">
12+
<annotations>
13+
<features value="Review"/>
14+
<stories value="Rating Form"/>
15+
<title value="Verify New Rating Form if single store mode is No"/>
16+
<description value="New Rating Form should have Default store view field if single store mode is No"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MC-21818"/>
19+
<group value="review"/>
20+
</annotations>
21+
<before>
22+
<magentoCLI command="config:set general/single_store_mode/enabled 0" stepKey="enabledSingleStoreMode"/>
23+
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
24+
</before>
25+
<after>
26+
<actionGroup ref="logout" stepKey="logout"/>
27+
</after>
28+
<actionGroup ref="AdminNavigateToNewRatingFormActionGroup" stepKey="navigateToNewRatingPage" />
29+
<actionGroup ref="AdminAssertStoreViewRatingTitleWhenSingleStoreModeIsNoActionGroup" stepKey="verifyForm" />
30+
</test>
31+
</tests>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminVerifyNewRatingFormSingleStoreModeYesTest">
12+
<annotations>
13+
<features value="Review"/>
14+
<stories value="Rating Form"/>
15+
<title value="Verify New Rating Form if single store mode is Yes"/>
16+
<description value="New Rating Form should not have Default store view field if single store mode is Yes"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MC-21818"/>
19+
<group value="review"/>
20+
</annotations>
21+
<before>
22+
<magentoCLI command="config:set general/single_store_mode/enabled 1" stepKey="enabledSingleStoreMode"/>
23+
<actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/>
24+
</before>
25+
<after>
26+
<magentoCLI command="config:set general/single_store_mode/enabled 0" stepKey="enabledSingleStoreMode"/>
27+
<actionGroup ref="logout" stepKey="logout"/>
28+
</after>
29+
<actionGroup ref="AdminNavigateToNewRatingFormActionGroup" stepKey="navigateToNewRatingPage" />
30+
<actionGroup ref="AdminAssertStoreViewRatingTitleWhenSingleStoreModeIsYesActionGroup" stepKey="verifyForm" />
31+
</test>
32+
</tests>

0 commit comments

Comments
 (0)