Skip to content

Commit 609cc05

Browse files
author
Cari Spruiell
committed
Merge branch 'MAGETWO-35023-Code-Coverage-Guest-Sales-And-Checkout-APIs' of github.scm.corp.ebay.com:magento-api/magento2ce into MAGETWO-35023-Code-Coverage-Guest-Sales-And-Checkout-APIs
2 parents 376bdae + 692b42e commit 609cc05

File tree

3 files changed

+22
-40
lines changed

3 files changed

+22
-40
lines changed

app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestBillingAddressManagementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function testGet()
8888
/**
8989
* @return void
9090
*/
91-
public function testAssing()
91+
public function testAssign()
9292
{
9393
$addressId = 1;
9494
$this->billingAddressManagementMock->expects($this->once())->method('assign')->willReturn($addressId);

app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestCartTotalRepositoryTest.php

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,45 +36,37 @@ class GuestCartTotalRepositoryTest extends \PHPUnit_Framework_TestCase
3636
/**
3737
* @var string
3838
*/
39-
protected $maskedCartId = 'f216207248d65c789b17be8545e0aa73';
39+
protected $maskedCartId;
4040

4141
/**
4242
* @var int
4343
*/
44-
protected $cartId = 12;
44+
protected $cartId;
4545

4646
public function setUp()
4747
{
4848
$this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
4949

50-
$this->quoteIdMaskFactoryMock = $this->getMockBuilder('Magento\Quote\Model\QuoteIdMaskFactory')
51-
->disableOriginalConstructor()
52-
->getMock();
53-
$this->quoteIdMaskMock = $this->getMockBuilder('Magento\Quote\Model\QuoteIdMask')
54-
->disableOriginalConstructor()
55-
->getMock();
5650
$this->cartTotalRepository = $this->getMockBuilder('Magento\Quote\Api\CartTotalRepositoryInterface')
5751
->disableOriginalConstructor()
5852
->getMock();
5953

54+
$this->maskedCartId = 'f216207248d65c789b17be8545e0aa73';
55+
$this->cartId = 123;
56+
57+
$guestCartTestHelper = new GuestCartTestHelper($this);
58+
list($this->quoteIdMaskFactoryMock, $this->quoteIdMaskMock) = $guestCartTestHelper->mockQuoteIdMask(
59+
$this->maskedCartId,
60+
$this->cartId
61+
);
62+
6063
$this->model = $this->objectManager->getObject(
6164
'Magento\Quote\Model\GuestCart\GuestCartTotalRepository',
6265
[
6366
'cartTotalRepository' => $this->cartTotalRepository,
6467
'quoteIdMaskFactory' => $this->quoteIdMaskFactoryMock,
6568
]
6669
);
67-
68-
$this->quoteIdMaskFactoryMock->expects($this->once())
69-
->method('create')
70-
->willReturn($this->quoteIdMaskMock);
71-
$this->quoteIdMaskMock->expects($this->once())
72-
->method('load')
73-
->with($this->maskedCartId, 'masked_id')
74-
->willReturn($this->quoteIdMaskMock);
75-
$this->quoteIdMaskMock->expects($this->once())
76-
->method('getId')
77-
->willReturn($this->cartId);
7870
}
7971

8072
public function testGetTotals()

app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestShippingMethodManagementTest.php

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,33 +46,23 @@ protected function setUp()
4646
$this->shippingMethodManagementMock =
4747
$this->getMockBuilder('Magento\Quote\Api\ShippingMethodManagementInterface')
4848
->getMockForAbstractClass();
49-
$this->quoteIdMaskFactoryMock = $this->getMockBuilder('Magento\Quote\Model\QuoteIdMaskFactory')
50-
->disableOriginalConstructor()
51-
->getMock();
52-
$this->quoteIdMaskMock = $this->getMockBuilder('Magento\Quote\Model\QuoteIdMask')
53-
->disableOriginalConstructor()
54-
->getMock();
49+
50+
$this->maskedCartId = 'f216207248d65c789b17be8545e0aa73';
51+
$this->cartId = 867;
52+
53+
$guestCartTestHelper = new GuestCartTestHelper($this);
54+
list($this->quoteIdMaskFactoryMock, $this->quoteIdMaskMock) = $guestCartTestHelper->mockQuoteIdMask(
55+
$this->maskedCartId,
56+
$this->cartId
57+
);
58+
5559
$this->model = $objectManager->getObject(
5660
'Magento\Quote\Model\GuestCart\GuestShippingMethodManagement',
5761
[
5862
'shippingMethodManagement' => $this->shippingMethodManagementMock,
5963
'quoteIdMaskFactory' => $this->quoteIdMaskFactoryMock,
6064
]
6165
);
62-
63-
$this->maskedCartId = 'f216207248d65c789b17be8545e0aa73';
64-
$this->cartId = 867;
65-
66-
$this->quoteIdMaskFactoryMock->expects($this->once())
67-
->method('create')
68-
->willReturn($this->quoteIdMaskMock);
69-
$this->quoteIdMaskMock->expects($this->once())
70-
->method('load')
71-
->with($this->maskedCartId, 'masked_id')
72-
->willReturn($this->quoteIdMaskMock);
73-
$this->quoteIdMaskMock->expects($this->once())
74-
->method('getId')
75-
->willReturn($this->cartId);
7666
}
7767

7868
public function testSet()

0 commit comments

Comments
 (0)