Skip to content

Commit 480f779

Browse files
committed
MC-31754: Storefront: Subscribe/unsubscribe to email newsletter
1 parent 030176f commit 480f779

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

dev/tests/integration/testsuite/Magento/Customer/Block/NewsletterTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\Customer\Block;
99

10+
use Magento\Customer\Model\Session;
1011
use Magento\Framework\ObjectManagerInterface;
1112
use Magento\Framework\View\LayoutInterface;
1213
use Magento\TestFramework\Helper\Bootstrap;
@@ -19,6 +20,7 @@
1920
* @see \Magento\Customer\Block\Newsletter
2021
* @magentoAppArea frontend
2122
* @magentoDbIsolation enabled
23+
* @magentoDataFixture Magento/Customer/_files/customer.php
2224
*/
2325
class NewsletterTest extends TestCase
2426
{
@@ -40,6 +42,9 @@ class NewsletterTest extends TestCase
4042
/** @var Newsletter */
4143
private $block;
4244

45+
/** @var Session */
46+
private $customerSession;
47+
4348
/**
4449
* @inheritdoc
4550
*/
@@ -50,13 +55,15 @@ protected function setUp()
5055
$this->objectManager = Bootstrap::getObjectManager();
5156
$this->layout = $this->objectManager->get(LayoutInterface::class);
5257
$this->block = $this->layout->createBlock(Newsletter::class);
58+
$this->customerSession = $this->objectManager->get(Session::class);
5359
}
5460

5561
/**
5662
* @return void
5763
*/
5864
public function testSubscriptionCheckbox(): void
5965
{
66+
$this->customerSession->loginById(1);
6067
$html = $this->block->toHtml();
6168
$this->assertEquals(
6269
1,

0 commit comments

Comments
 (0)