Skip to content

Commit f045f37

Browse files
author
Oleksii Korshenko
authored
MAGETWO-85783: #12439 Newsletter subscription success email not sent… #12751
2 parents 7942ac5 + 0a8e4a4 commit f045f37

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

app/code/Magento/Newsletter/Model/Subscriber.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,8 @@ public function confirm($code)
633633
$this->setStatus(self::STATUS_SUBSCRIBED)
634634
->setStatusChanged(true)
635635
->save();
636+
637+
$this->sendConfirmationSuccessEmail();
636638
return true;
637639
}
638640

app/code/Magento/Newsletter/Test/Unit/Model/SubscriberTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,21 @@ public function testConfirm()
341341
$code = 111;
342342
$this->subscriber->setCode($code);
343343
$this->resource->expects($this->once())->method('save')->willReturnSelf();
344+
$storeModel = $this->getMockBuilder(\Magento\Store\Model\Store::class)
345+
->disableOriginalConstructor()
346+
->setMethods(['getId'])
347+
->getMock();
348+
$transport = $this->createMock(\Magento\Framework\Mail\TransportInterface::class);
349+
$this->scopeConfig->expects($this->any())->method('getValue')->willReturn(true);
350+
$this->transportBuilder->expects($this->once())->method('setTemplateIdentifier')->willReturnSelf();
351+
$this->transportBuilder->expects($this->once())->method('setTemplateOptions')->willReturnSelf();
352+
$this->transportBuilder->expects($this->once())->method('setTemplateVars')->willReturnSelf();
353+
$this->transportBuilder->expects($this->once())->method('setFrom')->willReturnSelf();
354+
$this->transportBuilder->expects($this->once())->method('addTo')->willReturnSelf();
355+
$this->storeManager->expects($this->any())->method('getStore')->willReturn($storeModel);
356+
$storeModel->expects($this->any())->method('getId')->willReturn(1);
357+
$this->transportBuilder->expects($this->once())->method('getTransport')->willReturn($transport);
358+
$transport->expects($this->once())->method('sendMessage')->willReturnSelf();
344359

345360
$this->assertTrue($this->subscriber->confirm($code));
346361
}

0 commit comments

Comments
 (0)