Skip to content

Commit 0f5977e

Browse files
author
Stanislav Idolov
committed
MAGETWO-54109: Unskip Tests which Refer to Already Closed Tickets
1 parent 0395357 commit 0f5977e

File tree

24 files changed

+693
-1218
lines changed

24 files changed

+693
-1218
lines changed

app/code/Magento/Checkout/Test/Unit/Model/ShippingInformationManagementTest.php

Lines changed: 177 additions & 397 deletions
Large diffs are not rendered by default.

app/code/Magento/Customer/Test/Unit/Model/Address/AbstractAddressTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,15 +245,14 @@ public function testSetData()
245245
*/
246246
public function testSetDataWithMultidimensionalArray()
247247
{
248-
$this->markTestSkipped('Need to revert changes from MAGETWO-39106 and then modify this test.');
249248
$expected = [
250249
'key' => 'value',
251-
'array' => 'value1',
250+
'street' => 'value1',
252251
];
253252

254253
$key = [
255254
'key' => 'value',
256-
'array' => [
255+
'street' => [
257256
'key1' => 'value1',
258257
]
259258
];

app/code/Magento/Quote/Test/Unit/Model/BillingAddressManagementTest.php

Lines changed: 38 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -76,95 +76,40 @@ public function testGetAddress()
7676
$this->assertEquals($addressMock, $this->model->get('cartId'));
7777
}
7878

79-
/**
80-
* @return void
81-
* @expectedException \Magento\Framework\Exception\NoSuchEntityException
82-
* @expectedExceptionMessage error123
83-
*/
84-
public function testSetAddressValidationFailed()
85-
{
86-
$this->markTestSkipped('MAGETWO-48531');
87-
$address = $this->getMock(\Magento\Quote\Api\Data\AddressInterface::class);
88-
$quoteMock = $this->getMock(\Magento\Quote\Model\Quote::class, [], [], '', false);
89-
$this->quoteRepositoryMock->expects($this->once())
90-
->method('getActive')
91-
->with('cartId')
92-
->will($this->returnValue($quoteMock));
93-
94-
$this->validatorMock->expects($this->once())
95-
->method('validate')
96-
->will($this->throwException(new \Magento\Framework\Exception\NoSuchEntityException(__('error123'))));
97-
98-
$this->model->assign('cartId', $address);
99-
}
100-
10179
/**
10280
* @return void
10381
*/
10482
public function testSetAddress()
10583
{
106-
$this->markTestSkipped('MAGETWO-48531');
10784
$cartId = 100;
10885
$useForShipping = true;
10986
$addressId = 1;
110-
$customerAddressId = 10;
11187

11288
$address = $this->getMock(
11389
\Magento\Quote\Model\Quote\Address::class,
114-
['setSaveInAddressBook', 'getCustomerAddressId', 'getSaveInAddressBook'],
90+
['getId'],
11591
[],
11692
'',
11793
false
11894
);
119-
$quoteMock = $this->getMock(\Magento\Quote\Model\Quote::class, [], [], '', false);
120-
121-
$this->quoteRepositoryMock->expects($this->once())
122-
->method('getActive')
123-
->with($cartId)
124-
->willReturn($quoteMock);
125-
$this->validatorMock->expects($this->once())->method('validate')
126-
->with($address)
127-
->willReturn(true);
128-
129-
$address->expects($this->once())->method('getCustomerAddressId')->willReturn($customerAddressId);
130-
$address->expects($this->once())->method('getSaveInAddressBook')->willReturn(1);
131-
132-
$customerAddressMock = $this->getMock(\Magento\Customer\Api\Data\AddressInterface::class, [], [], '', false);
133-
$this->addressRepository->expects($this->once())
134-
->method('getById')
135-
->with($customerAddressId)
136-
->willReturn($customerAddressMock);
137-
138-
$quoteBillingAddress = $this->getMock(\Magento\Quote\Model\Quote\Address::class, [], [], '', false);
139-
$quoteBillingAddress->expects($this->once())->method('getId')->will($this->returnValue($addressId));
140-
$quoteMock->expects($this->exactly(2))->method('getBillingAddress')->willReturn($quoteBillingAddress);
141-
$quoteBillingAddress->expects($this->once())
142-
->method('importCustomerAddressData')
143-
->with($customerAddressMock)
144-
->willReturnSelf();
145-
146-
$quoteShippingAddress = $this->getMock(
147-
\Magento\Quote\Model\Quote\Address::class,
148-
['setSaveInAddressBook', 'setSameAsBilling', 'setCollectShippingRates', 'importCustomerAddressData'],
95+
$quoteMock = $this->getMock(
96+
\Magento\Quote\Model\Quote::class,
97+
['removeAddress', 'getBillingAddress', 'setBillingAddress', 'setDataChanges'],
14998
[],
15099
'',
151100
false
152101
);
153-
$quoteMock->expects($this->once())->method('getShippingAddress')->willReturn($quoteShippingAddress);
154-
$quoteShippingAddress->expects($this->once())
155-
->method('importCustomerAddressData')
156-
->with($customerAddressMock)
157-
->willReturnSelf();
158-
$quoteShippingAddress->expects($this->once())->method('setSaveInAddressBook')->with(1)->willReturnSelf();
159102

160-
$quoteBillingAddress->expects($this->once())->method('setSaveInAddressBook')->with(1)->willReturnSelf();
161-
$quoteMock->expects($this->once())->method('setBillingAddress')->with($quoteBillingAddress)->willReturnSelf();
162-
163-
$quoteShippingAddress->expects($this->once())->method('setSameAsBilling')->with(1)->willReturnSelf();
164-
$quoteShippingAddress->expects($this->once())->method('setCollectShippingRates')->with(true)->willReturnSelf();
103+
$this->quoteRepositoryMock->expects($this->once())
104+
->method('getActive')
105+
->with($cartId)
106+
->willReturn($quoteMock);
165107

166-
$quoteMock->expects($this->once())->method('setShippingAddress')->with($quoteShippingAddress);
167-
$quoteMock->expects($this->once())->method('setDataChanges')->with(true);
108+
$address->expects($this->exactly(2))->method('getId')->willReturn($addressId);
109+
$quoteMock->expects($this->exactly(2))->method('getBillingAddress')->willReturn($address);
110+
$quoteMock->expects($this->once())->method('removeAddress')->with($addressId)->willReturnSelf();
111+
$quoteMock->expects($this->once())->method('setBillingAddress')->with($address)->willReturnSelf();
112+
$quoteMock->expects($this->once())->method('setDataChanges')->with(1)->willReturnSelf();
168113

169114
$this->quoteRepositoryMock->expects($this->once())->method('save')->with($quoteMock);
170115
$this->assertEquals($addressId, $this->model->assign($cartId, $address, $useForShipping));
@@ -177,27 +122,41 @@ public function testSetAddress()
177122
*/
178123
public function testSetAddressWithInabilityToSaveQuote()
179124
{
180-
$this->markTestSkipped('MAGETWO-48531');
181-
$address = $this->getMock(\Magento\Quote\Model\Quote\Address::class, [], [], '', false, false);
125+
$cartId = 100;
126+
$addressId = 1;
127+
128+
$address = $this->getMock(
129+
\Magento\Quote\Model\Quote\Address::class,
130+
['getId'],
131+
[],
132+
'',
133+
false
134+
);
135+
$quoteMock = $this->getMock(
136+
\Magento\Quote\Model\Quote::class,
137+
['removeAddress', 'getBillingAddress', 'setBillingAddress', 'setDataChanges'],
138+
[],
139+
'',
140+
false
141+
);
182142

183-
$quoteMock = $this->getMock(\Magento\Quote\Model\Quote::class, [], [], '', false);
184143
$this->quoteRepositoryMock->expects($this->once())
185144
->method('getActive')
186-
->with('cartId')
187-
->will($this->returnValue($quoteMock));
145+
->with($cartId)
146+
->willReturn($quoteMock);
188147

189-
$this->validatorMock->expects($this->once())->method('validate')
190-
->with($address)
191-
->will($this->returnValue(true));
148+
$address->expects($this->once())->method('getId')->willReturn($addressId);
149+
$quoteMock->expects($this->once())->method('getBillingAddress')->willReturn($address);
150+
$quoteMock->expects($this->once())->method('removeAddress')->with($addressId)->willReturnSelf();
151+
$quoteMock->expects($this->once())->method('setBillingAddress')->with($address)->willReturnSelf();
152+
$quoteMock->expects($this->once())->method('setDataChanges')->with(1)->willReturnSelf();
192153

193-
$quoteMock->expects($this->once())->method('setBillingAddress')->with($address);
194-
$quoteMock->expects($this->once())->method('setDataChanges')->with(true);
195154
$this->quoteRepositoryMock->expects($this->once())
196155
->method('save')
197156
->with($quoteMock)
198157
->willThrowException(
199158
new \Exception('Some DB Error')
200159
);
201-
$this->model->assign('cartId', $address);
160+
$this->model->assign($cartId, $address);
202161
}
203162
}

0 commit comments

Comments
 (0)