|
6 | 6 |
|
7 | 7 | namespace Magento\OfflineShipping\Test\Unit\Model\Quote\Address;
|
8 | 8 |
|
| 9 | +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; |
| 10 | + |
9 | 11 | class FreeShippingTest extends \PHPUnit_Framework_TestCase
|
10 | 12 | {
|
11 | 13 | /**
|
@@ -51,6 +53,7 @@ public function testIsFreeShipping()
|
51 | 53 | $storeId = 100;
|
52 | 54 | $websiteId = 200;
|
53 | 55 | $customerGroupId = 300;
|
| 56 | + $objectManagerMock = new ObjectManagerHelper($this); |
54 | 57 | $quoteMock = $this->getMock(
|
55 | 58 | \Magento\Quote\Model\Quote::class,
|
56 | 59 | ['getShippingAddress', 'getStoreId', 'getCustomerGroupId', 'getCouponCode'],
|
@@ -92,18 +95,9 @@ public function testIsFreeShipping()
|
92 | 95 | $this->calculatorMock->expects($this->exactly(2))->method('processFreeShipping')->willReturnSelf();
|
93 | 96 | $itemMock->expects($this->once())->method('getFreeShipping')->willReturn(true);
|
94 | 97 |
|
95 |
| - $addressMock = $this->getMock( |
96 |
| - \Magento\Quote\Model\Quote\Address::class, |
97 |
| - ['getFreeShipping', 'setFreeShipping'], |
98 |
| - [], |
99 |
| - '', |
100 |
| - false |
101 |
| - ); |
102 |
| - $itemMock->expects($this->exactly(2))->method('getAddress')->willReturn($addressMock); |
103 |
| - $addressMock->expects($this->at(1))->method('getFreeShipping')->willReturn(false); |
104 |
| - $addressMock->expects($this->at(2))->method('getFreeShipping')->willReturn(true); |
105 |
| - $addressMock->expects($this->once())->method('setFreeShipping')->with(true)->willReturnSelf(); |
| 98 | + $addressMock = $objectManagerMock->getObject(\Magento\Quote\Model\Quote\Address::class); |
106 | 99 | $quoteMock->expects($this->once())->method('getShippingAddress')->willReturn($addressMock);
|
| 100 | + $itemMock->expects($this->exactly(2))->method('getAddress')->willReturn($addressMock); |
107 | 101 |
|
108 | 102 | $itemMock->expects($this->once())->method('getHasChildren')->willReturn(true);
|
109 | 103 | $itemMock->expects($this->once())->method('isChildrenCalculated')->willReturn(true);
|
|
0 commit comments