diff --git a/app/code/Magento/Checkout/Test/Unit/Controller/Onepage/IndexTest.php b/app/code/Magento/Checkout/Test/Unit/Controller/Onepage/IndexTest.php index f3a3f246ec1ee9acff0150dd74735d03a4be9dc5..5159d70026cbc5c902e6adc3c3b80d21e22ea64e 100644 --- a/app/code/Magento/Checkout/Test/Unit/Controller/Onepage/IndexTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Controller/Onepage/IndexTest.php @@ -188,6 +188,7 @@ class IndexTest extends \PHPUnit_Framework_TestCase $this->basicStub($this->quoteMock, 'hasItems')->willReturn(true); $this->basicStub($this->quoteMock, 'getHasError')->willReturn(false); $this->basicStub($this->quoteMock, 'validateMinimumAmount')->willReturn(true); + $this->basicStub($this->sessionMock, 'isLoggedIn')->willReturn(true); //Expected outcomes $this->sessionMock->expects($this->once())->method('regenerateId'); diff --git a/app/code/Magento/Quote/Test/Unit/Model/Cart/Totals/ItemConverterTest.php b/app/code/Magento/Quote/Test/Unit/Model/Cart/Totals/ItemConverterTest.php index 6823fdb803d2807f4f66e8bf4a88a279b0df0c91..b9770ab17fc4d02eb7d75838f4104acf4f41735b 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/Cart/Totals/ItemConverterTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/Cart/Totals/ItemConverterTest.php @@ -40,7 +40,7 @@ class ItemConverterTest extends \PHPUnit_Framework_TestCase $this->dataObjectHelperMock = $this->getMock('Magento\Framework\Api\DataObjectHelper', [], [], '', false); $this->totalsFactoryMock = $this->getMock( 'Magento\Quote\Api\Data\TotalsItemInterfaceFactory', - [], + ['create'], [], '', false diff --git a/app/code/Magento/Quote/Test/Unit/Model/QuoteManagementTest.php b/app/code/Magento/Quote/Test/Unit/Model/QuoteManagementTest.php index 56885a81d78648500927d8b77992e9cddea8a2ee..287aaaa980f7ae354b3726adaea44f2e893cdbfc 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/QuoteManagementTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/QuoteManagementTest.php @@ -717,47 +717,10 @@ class QuoteManagementTest extends \PHPUnit_Framework_TestCase $this->checkoutSessionMock->expects($this->once())->method('setLastSuccessQuoteId')->with($cartId); $this->checkoutSessionMock->expects($this->once())->method('setLastOrderId')->with($orderId); $this->checkoutSessionMock->expects($this->once())->method('setLastRealOrderId')->with($orderIncrementId); - $this->agreementsValidatorMock->expects($this->once())->method('isValid')->willReturn(true); $this->assertEquals($orderId, $service->placeOrder($cartId)); } - /** - * @expectedException \Magento\Framework\Exception\CouldNotSaveException - */ - public function testPlaceOrderIfAgreementsIsNotValid() - { - $this->agreementsValidatorMock->expects($this->once())->method('isValid')->willReturn(false); - - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Quote\Model\QuoteManagement $service */ - $service = $this->getMock( - '\Magento\Quote\Model\QuoteManagement', - ['submit'], - [ - 'eventManager' => $this->eventManager, - 'quoteValidator' => $this->quoteValidator, - 'orderFactory' => $this->orderFactory, - 'orderManagement' => $this->orderManagement, - 'customerManagement' => $this->customerManagement, - 'quoteAddressToOrder' => $this->quoteAddressToOrder, - 'quoteAddressToOrderAddress' => $this->quoteAddressToOrderAddress, - 'quoteItemToOrderItem' => $this->quoteItemToOrderItem, - 'quotePaymentToOrderPayment' => $this->quotePaymentToOrderPayment, - 'userContext' => $this->userContextMock, - 'quoteRepository' => $this->quoteRepositoryMock, - 'customerRepository' => $this->customerRepositoryMock, - 'customerModelFactory' => $this->customerFactoryMock, - 'dataObjectHelper' => $this->dataObjectHelperMock, - 'storeManager' => $this->storeManagerMock, - 'checkoutSession' => $this->checkoutSessionMock, - 'customerSession' => $this->customerSessionMock, - 'accountManagement' => $this->accountManagementMock, - 'agreementsValidator' => $this->agreementsValidatorMock, - ] - ); - $service->placeOrder(45); - } - public function testPlaceOrder() { $cartId = 323; @@ -829,7 +792,6 @@ class QuoteManagementTest extends \PHPUnit_Framework_TestCase $this->checkoutSessionMock->expects($this->once())->method('setLastSuccessQuoteId')->with($cartId); $this->checkoutSessionMock->expects($this->once())->method('setLastOrderId')->with($orderId); $this->checkoutSessionMock->expects($this->once())->method('setLastRealOrderId')->with($orderIncrementId); - $this->agreementsValidatorMock->expects($this->once())->method('isValid')->willReturn(true); $paymentMethod = $this->getMock('Magento\Quote\Model\Quote\Payment', ['setChecks', 'getData'], [], '', false); $paymentMethod->expects($this->once())->method('setChecks'); diff --git a/app/code/Magento/Quote/Test/Unit/Model/ShippingMethodManagementTest.php b/app/code/Magento/Quote/Test/Unit/Model/ShippingMethodManagementTest.php index ef5992e11f7af3c0dbedf4f7b8d263a12cf1804e..fd760977a6c89f57308b2142d4acd827af06bfa4 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/ShippingMethodManagementTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/ShippingMethodManagementTest.php @@ -316,39 +316,6 @@ class ShippingMethodManagementTest extends \PHPUnit_Framework_TestCase $this->model->set($cartId, $carrierCode, $methodCode); } - /** - * @expectedException \Magento\Framework\Exception\StateException - * @expectedExceptionMessage Billing address is not set - */ - public function testSetMethodWithoutBillingAddress() - { - $cartId = 12; - $carrierCode = 34; - $methodCode = 56; - $countryId = 1; - - $this->quoteRepositoryMock->expects($this->once()) - ->method('getActive')->with($cartId)->will($this->returnValue($this->quoteMock)); - $this->quoteMock->expects($this->once())->method('getItemsCount')->will($this->returnValue(1)); - $this->quoteMock->expects($this->once())->method('isVirtual')->will($this->returnValue(false)); - $this->quoteMock->expects($this->once()) - ->method('getShippingAddress')->will($this->returnValue($this->shippingAddressMock)); - $this->shippingAddressMock->expects($this->once()) - ->method('getCountryId')->will($this->returnValue($countryId)); - $billingAddressMock = $this->getMock( - '\Magento\Quote\Model\Quote\Address', - ['getCountryId', '__wakeup'], - [], - '', - false - ); - $this->quoteMock->expects($this->once()) - ->method('getBillingAddress')->will($this->returnValue($billingAddressMock)); - $billingAddressMock->expects($this->once())->method('getCountryId')->will($this->returnValue(null)); - - $this->model->set($cartId, $carrierCode, $methodCode); - } - /** * @expectedException \Magento\Framework\Exception\NoSuchEntityException * @expectedExceptionMessage Carrier with such method not found: 34, 56 @@ -365,16 +332,6 @@ class ShippingMethodManagementTest extends \PHPUnit_Framework_TestCase $this->quoteMock->expects($this->once())->method('isVirtual')->will($this->returnValue(false)); $this->quoteMock->expects($this->once()) ->method('getShippingAddress')->will($this->returnValue($this->shippingAddressMock)); - $billingAddressMock = $this->getMock( - '\Magento\Quote\Model\Quote\Address', - ['getCountryId', '__wakeup'], - [], - '', - false - ); - $this->quoteMock->expects($this->once()) - ->method('getBillingAddress')->will($this->returnValue($billingAddressMock)); - $billingAddressMock->expects($this->once())->method('getCountryId')->will($this->returnValue(23)); $this->shippingAddressMock->expects($this->once()) ->method('getCountryId')->will($this->returnValue($countryId)); $this->shippingAddressMock->expects($this->once()) @@ -405,19 +362,6 @@ class ShippingMethodManagementTest extends \PHPUnit_Framework_TestCase ->method('getShippingAddress')->will($this->returnValue($this->shippingAddressMock)); $this->shippingAddressMock->expects($this->once()) ->method('getCountryId')->will($this->returnValue($countryId)); - $billingAddressMock = $this->getMock( - '\Magento\Quote\Model\Quote\Address', - [ - 'getCountryId', - '__wakeup' - ], - [], - '', - false - ); - $this->quoteMock->expects($this->once()) - ->method('getBillingAddress')->will($this->returnValue($billingAddressMock)); - $billingAddressMock->expects($this->once())->method('getCountryId')->will($this->returnValue(23)); $this->shippingAddressMock->expects($this->once()) ->method('setShippingMethod')->with($carrierCode . '_' . $methodCode); $this->shippingAddressMock->expects($this->once()) @@ -464,19 +408,6 @@ class ShippingMethodManagementTest extends \PHPUnit_Framework_TestCase $this->quoteMock->expects($this->once())->method('isVirtual')->will($this->returnValue(false)); $this->quoteMock->expects($this->once()) ->method('getShippingAddress')->will($this->returnValue($this->shippingAddressMock)); - $billingAddressMock = $this->getMock( - '\Magento\Quote\Model\Quote\Address', - [ - 'getCountryId', - '__wakeup' - ], - [], - '', - false - ); - $this->quoteMock->expects($this->once()) - ->method('getBillingAddress')->will($this->returnValue($billingAddressMock)); - $billingAddressMock->expects($this->once())->method('getCountryId')->will($this->returnValue(23)); $this->shippingAddressMock->expects($this->once()) ->method('getCountryId')->will($this->returnValue($countryId)); $this->shippingAddressMock->expects($this->once())