Skip to content

Commit

Permalink
ENGCOM-8675: Changed Newsletter Enabled/Disable config settings by pr…
Browse files Browse the repository at this point in the history
…iority, store scope then default scope #31208
  • Loading branch information
gabrieldagama authored Jan 24, 2021
2 parents e5d0279 + a687390 commit 33d322b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/code/Magento/Customer/Block/Form/Register.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Magento\Customer\Model\AccountManagement;
use Magento\Framework\App\ObjectManager;
use Magento\Newsletter\Model\Config;
use Magento\Store\Model\ScopeInterface;

/**
* Customer register form block
Expand Down Expand Up @@ -184,7 +185,7 @@ public function getRegion()
public function isNewsletterEnabled()
{
return $this->_moduleManager->isOutputEnabled('Magento_Newsletter')
&& $this->newsLetterConfig->isActive();
&& $this->newsLetterConfig->isActive(ScopeInterface::SCOPE_STORE);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="StorefrontNewsletterSubscriptionDisabledForStoreViewAtRegistrationTest">
<annotations>
<features value="Newsletter"/>
<stories value="Disabled Newsletter Subscription for store View"/>
<title value="Disabled Newsletter Subscription for store View"/>
<description value="Option to subscribe should not be displayed at registration form if it is switched off for current store"/>
<severity value="AVERAGE"/>
<group value="newsletter"/>
<group value="configuration"/>
<testCaseId value="MC-*"/>
</annotations>
<before>
<magentoCLI command="config:set --scope=stores --scope-code=default newsletter/general/active 0" stepKey="disableSubscriptionForStore"/>
</before>
<after>
<magentoCLI command="config:set --scope=stores --scope-code=default newsletter/general/active 1" stepKey="enableSubscriptionForStore"/>
</after>
<actionGroup ref="StorefrontOpenCustomerAccountCreatePageActionGroup" stepKey="openCreateAccountPage"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
<dontSeeElement selector="{{StorefrontCustomerCreateFormSection.signUpForNewsletter}}" stepKey="checkNoSubscriptionOption"/>
</test>
</tests>

0 comments on commit 33d322b

Please sign in to comment.