diff --git a/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestBillingAddressManagementTest.php b/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestBillingAddressManagementTest.php index 52e611b25bde35ea2f09d7d06f7d5926177e3e20..4f6a3e63a632df58afc6eadeb44871820866100c 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestBillingAddressManagementTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestBillingAddressManagementTest.php @@ -88,7 +88,7 @@ class GuestBillingAddressManagementTest extends \PHPUnit_Framework_TestCase /** * @return void */ - public function testAssing() + public function testAssign() { $addressId = 1; $this->billingAddressManagementMock->expects($this->once())->method('assign')->willReturn($addressId); diff --git a/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestCartTotalRepositoryTest.php b/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestCartTotalRepositoryTest.php index 4d39e8edeea32461e5099fd01ea794823a5a6fe2..a8ef8d94e9fa2f92b324d81931ed87c7cd647e0b 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestCartTotalRepositoryTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestCartTotalRepositoryTest.php @@ -36,27 +36,30 @@ class GuestCartTotalRepositoryTest extends \PHPUnit_Framework_TestCase /** * @var string */ - protected $maskedCartId = 'f216207248d65c789b17be8545e0aa73'; + protected $maskedCartId; /** * @var int */ - protected $cartId = 12; + protected $cartId; public function setUp() { $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->quoteIdMaskFactoryMock = $this->getMockBuilder('Magento\Quote\Model\QuoteIdMaskFactory') - ->disableOriginalConstructor() - ->getMock(); - $this->quoteIdMaskMock = $this->getMockBuilder('Magento\Quote\Model\QuoteIdMask') - ->disableOriginalConstructor() - ->getMock(); $this->cartTotalRepository = $this->getMockBuilder('Magento\Quote\Api\CartTotalRepositoryInterface') ->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 +67,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() diff --git a/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestShippingMethodManagementTest.php b/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestShippingMethodManagementTest.php index 07a83b5e281e6e833f6f01a1f56a9a8987a7481a..c91510a165fac2c1ecbacf3400cfba4b6f6d5be1 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestShippingMethodManagementTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestShippingMethodManagementTest.php @@ -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()