Skip to content

Commit 5de4492

Browse files
Ievgen ShakhsuvarovSerhiy Shkolyarenko
authored andcommitted
MAGETWO-33343: Wrong "customer_id" value for GiftMessages created using API service
- Unit tests fix
1 parent c1077a3 commit 5de4492

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

dev/tests/unit/testsuite/Magento/GiftMessage/Model/GiftMessageManagerTest.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ protected function setUp()
7070
'getAddressById',
7171
'getBillingAddress',
7272
'getShippingAddress',
73-
'__wakeup'],
73+
'__wakeup',
74+
'getCustomerId'
75+
],
7476
[],
7577
'',
7678
false);
@@ -114,6 +116,7 @@ protected function setUp()
114116
'setSender',
115117
'setRecipient',
116118
'setMessage',
119+
'setCustomerId',
117120
'getSender',
118121
'getRecipient',
119122
'getMessage',
@@ -182,6 +185,7 @@ public function testAddWithSaveMessageIdException()
182185
],
183186
],
184187
];
188+
$customerId = 42;
185189

186190
$this->messageFactoryMock->expects($this->once())
187191
->method('create')
@@ -199,6 +203,11 @@ public function testAddWithSaveMessageIdException()
199203
->method('setRecipient')
200204
->with('recipient')
201205
->will($this->returnValue($this->giftMessageMock));
206+
$this->quoteMock->expects($this->once())->method('getCustomerId')->willReturn($customerId);
207+
$this->giftMessageMock->expects($this->once())
208+
->method('setCustomerId')
209+
->with($customerId)
210+
->will($this->returnValue($this->giftMessageMock));
202211
$this->giftMessageMock->expects($this->once())
203212
->method('setMessage')
204213
->with('message')
@@ -227,6 +236,7 @@ public function testAddWithQuoteAddress()
227236
],
228237
],
229238
];
239+
$customerId = 42;
230240

231241
$this->messageFactoryMock->expects($this->once())
232242
->method('create')
@@ -248,6 +258,11 @@ public function testAddWithQuoteAddress()
248258
->method('setMessage')
249259
->with('message')
250260
->will($this->returnValue($this->giftMessageMock));
261+
$this->quoteMock->expects($this->once())->method('getCustomerId')->willReturn($customerId);
262+
$this->giftMessageMock->expects($this->once())
263+
->method('setCustomerId')
264+
->with($customerId)
265+
->will($this->returnValue($this->giftMessageMock));
251266
$this->giftMessageMock->expects($this->once())->method('save');
252267
$this->giftMessageMock->expects($this->once())->method('getId')->will($this->returnValue(33));
253268
$this->quoteAddressMock->expects($this->once())
@@ -271,6 +286,7 @@ public function testAddWithQuoteAddressItem()
271286
],
272287
],
273288
];
289+
$customerId = 42;
274290

275291
$this->messageFactoryMock->expects($this->once())
276292
->method('create')
@@ -296,6 +312,11 @@ public function testAddWithQuoteAddressItem()
296312
->method('setMessage')
297313
->with('message')
298314
->will($this->returnValue($this->giftMessageMock));
315+
$this->quoteMock->expects($this->once())->method('getCustomerId')->willReturn($customerId);
316+
$this->giftMessageMock->expects($this->once())
317+
->method('setCustomerId')
318+
->with($customerId)
319+
->will($this->returnValue($this->giftMessageMock));
299320
$this->giftMessageMock->expects($this->once())->method('save');
300321
$this->giftMessageMock->expects($this->once())->method('getId')->will($this->returnValue(33));
301322
$this->quoteAddressItemMock->expects($this->once())

0 commit comments

Comments
 (0)