Skip to content
Snippets Groups Projects
Commit 6b0058a1 authored by Bryant Luk's avatar Bryant Luk
Browse files

MAGETWO-36427: Magento\Quote\Api\GuestShippingMethodManagement

- Fix unit tests to use GuestCartTestHelper
parent 9dbffdb7
No related merge requests found
......@@ -57,6 +57,15 @@ class GuestCartTotalRepositoryTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor()
->getMock();
$this->maskedCartId = 'f216207248d65c789b17be8545e0aa73';
$this->cartId = 123;
$guestCartTestHelper = new GuestCartTestHelper($this);
list($this->quoteIdMaskFactoryMock, $this->quoteIdMaskMock) = $guestCartTestHelper->mockQuoteIdMask(
$this->maskedCartId,
$this->cartId
);
$this->model = $this->objectManager->getObject(
'Magento\Quote\Model\GuestCart\GuestCartTotalRepository',
[
......@@ -64,17 +73,6 @@ class GuestCartTotalRepositoryTest extends \PHPUnit_Framework_TestCase
'quoteIdMaskFactory' => $this->quoteIdMaskFactoryMock,
]
);
$this->quoteIdMaskFactoryMock->expects($this->once())
->method('create')
->willReturn($this->quoteIdMaskMock);
$this->quoteIdMaskMock->expects($this->once())
->method('load')
->with($this->maskedCartId, 'masked_id')
->willReturn($this->quoteIdMaskMock);
$this->quoteIdMaskMock->expects($this->once())
->method('getId')
->willReturn($this->cartId);
}
public function testGetTotals()
......
......@@ -46,12 +46,16 @@ class GuestShippingMethodManagementTest extends \PHPUnit_Framework_TestCase
$this->shippingMethodManagementMock =
$this->getMockBuilder('Magento\Quote\Api\ShippingMethodManagementInterface')
->getMockForAbstractClass();
$this->quoteIdMaskFactoryMock = $this->getMockBuilder('Magento\Quote\Model\QuoteIdMaskFactory')
->disableOriginalConstructor()
->getMock();
$this->quoteIdMaskMock = $this->getMockBuilder('Magento\Quote\Model\QuoteIdMask')
->disableOriginalConstructor()
->getMock();
$this->maskedCartId = 'f216207248d65c789b17be8545e0aa73';
$this->cartId = 867;
$guestCartTestHelper = new GuestCartTestHelper($this);
list($this->quoteIdMaskFactoryMock, $this->quoteIdMaskMock) = $guestCartTestHelper->mockQuoteIdMask(
$this->maskedCartId,
$this->cartId
);
$this->model = $objectManager->getObject(
'Magento\Quote\Model\GuestCart\GuestShippingMethodManagement',
[
......@@ -59,20 +63,6 @@ class GuestShippingMethodManagementTest extends \PHPUnit_Framework_TestCase
'quoteIdMaskFactory' => $this->quoteIdMaskFactoryMock,
]
);
$this->maskedCartId = 'f216207248d65c789b17be8545e0aa73';
$this->cartId = 867;
$this->quoteIdMaskFactoryMock->expects($this->once())
->method('create')
->willReturn($this->quoteIdMaskMock);
$this->quoteIdMaskMock->expects($this->once())
->method('load')
->with($this->maskedCartId, 'masked_id')
->willReturn($this->quoteIdMaskMock);
$this->quoteIdMaskMock->expects($this->once())
->method('getId')
->willReturn($this->cartId);
}
public function testSet()
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment