Skip to content

Commit fd33253

Browse files
author
Anna Bukatar
committed
MC-42764: Shipment Notify Customer by Email not working
1 parent bf4cdad commit fd33253

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentCommentSender.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public function send(Shipment $shipment, $notify = true, $comment = '')
7575
'formattedBillingAddress' => $this->getFormattedBillingAddress($order),
7676
'order_data' => [
7777
'customer_name' => $order->getCustomerName(),
78+
'is_not_virtual' => $order->getIsNotVirtual(),
7879
'frontend_status_label' => $order->getFrontendStatusLabel()
7980
]
8081
];

app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/ShipmentCommentSenderTest.php

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ public function testSendTrueWithoutCustomerCopy()
6262
{
6363
$billingAddress = $this->addressMock;
6464
$comment = 'comment_test';
65-
$customerName='Test Customer';
66-
$frontendStatusLabel='Processing';
65+
$customerName = 'Test Customer';
66+
$frontendStatusLabel = 'Processing';
67+
$isNotVirtual = true;
6768

6869
$this->orderMock->expects($this->once())
6970
->method('getCustomerIsGuest')
@@ -76,6 +77,9 @@ public function testSendTrueWithoutCustomerCopy()
7677
$this->orderMock->expects($this->any())
7778
->method('getCustomerName')
7879
->willReturn($customerName);
80+
$this->orderMock->expects($this->any())
81+
->method('getIsNotVirtual')
82+
->willReturn($isNotVirtual);
7983
$this->orderMock->expects($this->once())
8084
->method('getFrontendStatusLabel')
8185
->willReturn($frontendStatusLabel);
@@ -92,7 +96,8 @@ public function testSendTrueWithoutCustomerCopy()
9296
'formattedBillingAddress' => 1,
9397
'order_data' => [
9498
'customer_name' => $customerName,
95-
'frontend_status_label' => $frontendStatusLabel
99+
'frontend_status_label' => $frontendStatusLabel,
100+
'is_not_virtual' => $isNotVirtual,
96101
]
97102
]
98103
);
@@ -105,8 +110,9 @@ public function testSendTrueWithCustomerCopy()
105110
{
106111
$billingAddress = $this->addressMock;
107112
$comment = 'comment_test';
108-
$customerName='Test Customer';
109-
$frontendStatusLabel='Processing';
113+
$customerName = 'Test Customer';
114+
$frontendStatusLabel = 'Processing';
115+
$isNotVirtual = true;
110116

111117
$this->orderMock->expects($this->once())
112118
->method('getCustomerIsGuest')
@@ -122,6 +128,9 @@ public function testSendTrueWithCustomerCopy()
122128
$this->orderMock->expects($this->any())
123129
->method('getCustomerName')
124130
->willReturn($customerName);
131+
$this->orderMock->expects($this->any())
132+
->method('getIsNotVirtual')
133+
->willReturn($isNotVirtual);
125134
$this->orderMock->expects($this->once())
126135
->method('getFrontendStatusLabel')
127136
->willReturn($frontendStatusLabel);
@@ -138,7 +147,8 @@ public function testSendTrueWithCustomerCopy()
138147
'formattedBillingAddress' => 1,
139148
'order_data' => [
140149
'customer_name' => $customerName,
141-
'frontend_status_label' => $frontendStatusLabel
150+
'frontend_status_label' => $frontendStatusLabel,
151+
'is_not_virtual' => $isNotVirtual,
142152
]
143153
]
144154
);
@@ -152,15 +162,19 @@ public function testSendVirtualOrder()
152162
$isVirtualOrder = true;
153163
$this->orderMock->setData(OrderInterface::IS_VIRTUAL, $isVirtualOrder);
154164
$this->stepAddressFormat($this->addressMock, $isVirtualOrder);
155-
$customerName='Test Customer';
156-
$frontendStatusLabel='Complete';
165+
$customerName = 'Test Customer';
166+
$frontendStatusLabel = 'Complete';
167+
$isNotVirtual = false;
157168

158169
$this->identityContainerMock->expects($this->once())
159170
->method('isEnabled')
160171
->willReturn(false);
161172
$this->orderMock->expects($this->any())
162173
->method('getCustomerName')
163174
->willReturn($customerName);
175+
$this->orderMock->expects($this->any())
176+
->method('getIsNotVirtual')
177+
->willReturn($isNotVirtual);
164178
$this->orderMock->expects($this->once())
165179
->method('getFrontendStatusLabel')
166180
->willReturn($frontendStatusLabel);
@@ -177,7 +191,8 @@ public function testSendVirtualOrder()
177191
'formattedBillingAddress' => 1,
178192
'order_data' => [
179193
'customer_name' => $customerName,
180-
'frontend_status_label' => $frontendStatusLabel
194+
'frontend_status_label' => $frontendStatusLabel,
195+
'is_not_virtual' => $isNotVirtual
181196
]
182197

183198
]

0 commit comments

Comments
 (0)