Skip to content

Commit

Permalink
#19345: Removed caching subscription status from plugin - integration…
Browse files Browse the repository at this point in the history
… test fix.
  • Loading branch information
engcom-Foxtrot committed Mar 31, 2021
1 parent b1f9f8e commit a82f3e9
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Magento\Customer\Model\Session;
use Magento\Framework\Data\Form\FormKey;
use Magento\Framework\Message\MessageInterface;
use Magento\Newsletter\Model\CustomerSubscriberCache;
use Magento\Newsletter\Model\Plugin\CustomerPlugin;
use Magento\TestFramework\TestCase\AbstractController;

Expand Down Expand Up @@ -69,7 +70,6 @@ protected function tearDown(): void
public function testSaveAction(bool $isSubscribed, string $expectedMessage): void
{
$this->loginCustomer('[email protected]');
$this->_objectManager->removeSharedInstance(CustomerPlugin::class);
$this->dispatchSaveAction($isSubscribed);
$this->assertSuccessSubscription($expectedMessage);
}
Expand Down Expand Up @@ -112,7 +112,6 @@ public function testSubscribeWithEnabledConfirmation(): void
public function testUnsubscribeSubscribedCustomer(): void
{
$this->loginCustomer('[email protected]');
$this->_objectManager->removeSharedInstance(CustomerPlugin::class);
$this->dispatchSaveAction(false);
$this->assertSuccessSubscription('We have removed your newsletter subscription.');
}
Expand All @@ -126,6 +125,7 @@ public function testUnsubscribeSubscribedCustomer(): void
private function dispatchSaveAction(bool $isSubscribed): void
{
$this->_objectManager->removeSharedInstance(CustomerPlugin::class);
$this->_objectManager->removeSharedInstance(CustomerSubscriberCache::class);
$this->getRequest()->setParam('form_key', $this->formKey->getFormKey())
->setParam('is_subscribed', $isSubscribed);
$this->dispatch('newsletter/manage/save');
Expand Down

0 comments on commit a82f3e9

Please sign in to comment.