Skip to content

Commit f8734d6

Browse files
author
Dmytro Voskoboinikov
committed
Merge branch 'MAGETWO-34644' into MAGETWO-34647
2 parents 03f7b63 + 36c1d81 commit f8734d6

File tree

7 files changed

+68
-5
lines changed

7 files changed

+68
-5
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
/**
1818
* Class InvoiceSender
19+
*
20+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1921
*/
2022
class InvoiceSender extends Sender
2123
{

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
/**
1818
* Class ShipmentSender
19+
*
20+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1921
*/
2022
class ShipmentSender extends Sender
2123
{

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

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ public function stepMockSetup()
126126
->method('getPayment')
127127
->will($this->returnValue($paymentInfoMock));
128128

129-
130129
$this->addressRenderer = $this->getMock('Magento\Sales\Model\Order\Address\Renderer', [], [], '', false);
131130
$this->addressMock = $this->getMock('Magento\Sales\Model\Order\Address', [], [], '', false);
132131

@@ -151,4 +150,59 @@ public function stepMockSetup()
151150
false
152151
);
153152
}
153+
154+
public function stepAddressFormat($billingAddress)
155+
{
156+
$this->orderMock->expects($this->any())
157+
->method('getBillingAddress')
158+
->will($this->returnValue($billingAddress));
159+
$this->orderMock->expects($this->any())
160+
->method('getShippingAddress')
161+
->will($this->returnValue($billingAddress));
162+
}
163+
164+
public function stepSendWithoutSendCopy()
165+
{
166+
$this->stepSend($this->once(), $this->never());
167+
}
168+
169+
public function stepSendWithCallSendCopyTo()
170+
{
171+
$this->stepSend($this->never(), $this->once());
172+
}
173+
174+
public function stepIdentityContainerInit($identityMockClassName)
175+
{
176+
$this->identityContainerMock = $this->getMock(
177+
$identityMockClassName,
178+
['getStore', 'isEnabled', 'getConfigValue', 'getTemplateId', 'getGuestTemplateId'],
179+
[],
180+
'',
181+
false
182+
);
183+
$this->identityContainerMock->expects($this->any())
184+
->method('getStore')
185+
->will($this->returnValue($this->storeMock));
186+
}
187+
188+
protected function stepSend(
189+
\PHPUnit_Framework_MockObject_Matcher_InvokedCount $sendExpects,
190+
\PHPUnit_Framework_MockObject_Matcher_InvokedCount $sendCopyToExpects
191+
) {
192+
$senderMock = $this->getMock(
193+
'Magento\Sales\Model\Order\Email\Sender',
194+
['send', 'sendCopyTo'],
195+
[],
196+
'',
197+
false
198+
);
199+
$senderMock->expects($sendExpects)
200+
->method('send');
201+
$senderMock->expects($sendCopyToExpects)
202+
->method('sendCopyTo');
203+
204+
$this->senderBuilderFactoryMock->expects($this->once())
205+
->method('create')
206+
->will($this->returnValue($senderMock));
207+
}
154208
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ protected function setUp()
2626
{
2727
$this->stepMockSetup();
2828
$this->stepIdentityContainerInit('\Magento\Sales\Model\Order\Email\Container\CreditmemoCommentIdentity');
29+
$this->addressRenderer->expects($this->any())->method('format')->willReturn(1);
2930
$this->creditmemoMock = $this->getMock(
3031
'\Magento\Sales\Model\Order\Creditmemo',
3132
['getStore', '__wakeup', 'getOrder'],
@@ -44,7 +45,7 @@ protected function setUp()
4445
$this->identityContainerMock,
4546
$this->senderBuilderFactoryMock,
4647
$this->loggerMock,
47-
$this->addressRendererMock
48+
$this->addressRenderer
4849
);
4950
}
5051

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ protected function setUp()
4040

4141
$this->stepIdentityContainerInit('\Magento\Sales\Model\Order\Email\Container\InvoiceCommentIdentity');
4242

43+
$this->addressRenderer->expects($this->any())->method('format')->willReturn(1);
44+
4345
$this->invoiceMock = $this->getMock(
4446
'\Magento\Sales\Model\Order\Invoice',
4547
['getStore', '__wakeup', 'getOrder'],
@@ -59,7 +61,7 @@ protected function setUp()
5961
$this->identityContainerMock,
6062
$this->senderBuilderFactoryMock,
6163
$this->loggerMock,
62-
$this->addressRendererMock
64+
$this->addressRenderer
6365
);
6466
}
6567

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ protected function setUp()
1818
{
1919
$this->stepMockSetup();
2020
$this->stepIdentityContainerInit('\Magento\Sales\Model\Order\Email\Container\OrderCommentIdentity');
21+
$this->addressRenderer->expects($this->any())->method('format')->willReturn(1);
2122
$this->sender = new OrderCommentSender(
2223
$this->templateContainerMock,
2324
$this->identityContainerMock,
2425
$this->senderBuilderFactoryMock,
2526
$this->loggerMock,
26-
$this->addressRendererMock
27+
$this->addressRenderer
2728
);
2829
}
2930

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ protected function setUp()
2323
{
2424
$this->stepMockSetup();
2525
$this->stepIdentityContainerInit('\Magento\Sales\Model\Order\Email\Container\ShipmentCommentIdentity');
26+
$this->addressRenderer->expects($this->any())->method('format')->willReturn(1);
2627
$this->shipmentMock = $this->getMock(
2728
'\Magento\Sales\Model\Order\Shipment',
2829
['getStore', '__wakeup', 'getOrder'],
@@ -42,7 +43,7 @@ protected function setUp()
4243
$this->identityContainerMock,
4344
$this->senderBuilderFactoryMock,
4445
$this->loggerMock,
45-
$this->addressRendererMock
46+
$this->addressRenderer
4647
);
4748
}
4849

0 commit comments

Comments
 (0)