32 $this->customerSession->setCustomerId(1);
34 $this->coreSession->setData(
'_form_key',
'formKey');
42 $this->customerSession->setCustomerId(
null);
43 $this->coreSession->unsData(
'_form_key');
52 ->setParam(
'form_key',
'formKey')
53 ->setParam(
'is_subscribed',
'1');
54 $this->dispatch(
'newsletter/manage/save');
61 $this->assertSessionMessages($this->isEmpty(), \
Magento\Framework\Message\MessageInterface::TYPE_ERROR);
66 $this->assertSessionMessages(
67 $this->equalTo([
'We have saved your subscription.']),
68 \
Magento\Framework\Message\MessageInterface::TYPE_SUCCESS
79 ->setParam(
'form_key',
'formKey')
80 ->setParam(
'is_subscribed',
'0');
81 $this->dispatch(
'newsletter/manage/save');
88 $this->assertSessionMessages($this->isEmpty(), \
Magento\Framework\Message\MessageInterface::TYPE_ERROR);
93 $this->assertSessionMessages(
94 $this->equalTo([
'We have updated your subscription.']),
95 \
Magento\Framework\Message\MessageInterface::TYPE_SUCCESS
assertRedirect(\PHPUnit\Framework\Constraint\Constraint $urlConstraint=null)
testSaveActionRemoveSubscription()
static getObjectManager()