diff --git a/app/code/Magento/Captcha/Test/Unit/Model/Cart/ConfigPluginTest.php b/app/code/Magento/Captcha/Test/Unit/Model/Cart/ConfigPluginTest.php new file mode 100644 index 0000000000000000000000000000000000000000..be94382ea2ab37ece92018a4738439fd998601d0 --- /dev/null +++ b/app/code/Magento/Captcha/Test/Unit/Model/Cart/ConfigPluginTest.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Captcha\Test\Unit\Model\Cart; + +class ConfigPluginTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Captcha\Model\Cart\ConfigPlugin + */ + protected $model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $configProviderMock; + + public function setUp() + { + $this->configProviderMock = $this->getMock('\Magento\Captcha\Model\Checkout\ConfigProvider', [], [], '', false); + $this->model = new \Magento\Captcha\Model\Cart\ConfigPlugin( + $this->configProviderMock + ); + } + + public function testAfterGetConfig() + { + $resultMock = [ + 'result' => [ + 'data' => 'resultDataMock' + ] + ]; + $configMock = [ + 'config' => [ + 'data' => 'configDataMock' + ] + ]; + $expectedResult = array_merge_recursive($resultMock, $configMock); + $sidebarMock = $this->getMock('\Magento\Checkout\Block\Cart\Sidebar', [], [], '', false); + $this->configProviderMock->expects($this->once())->method('getConfig')->willReturn($configMock); + + $this->assertEquals($expectedResult, $this->model->afterGetConfig($sidebarMock, $resultMock)); + } +} diff --git a/app/code/Magento/Catalog/Helper/Product/Compare.php b/app/code/Magento/Catalog/Helper/Product/Compare.php index 447daccb10d61d525eee8fbbd3cea619adb19e4e..504e990c86fb53a9105d28b82db721c0fcbca275 100644 --- a/app/code/Magento/Catalog/Helper/Product/Compare.php +++ b/app/code/Magento/Catalog/Helper/Product/Compare.php @@ -203,7 +203,8 @@ class Compare extends \Magento\Framework\Url\Helper\Data $beforeCompareUrl = $this->_catalogSession->getBeforeCompareUrl(); $params = [ 'product' => $product->getId(), - \Magento\Framework\App\Action\Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl($beforeCompareUrl) + \Magento\Framework\App\Action\Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl($beforeCompareUrl), + '_secure' => $this->_getRequest()->isSecure() ]; return $this->_getUrl('checkout/cart/add', $params); diff --git a/app/code/Magento/Catalog/Test/Unit/Helper/Product/CompareTest.php b/app/code/Magento/Catalog/Test/Unit/Helper/Product/CompareTest.php index 33a0ef0eae9310c284844e24fa2854c4079fc532..228381f7d3b300a62079b0241fa20fbff37e9ab4 100644 --- a/app/code/Magento/Catalog/Test/Unit/Helper/Product/CompareTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Helper/Product/CompareTest.php @@ -6,6 +6,8 @@ namespace Magento\Catalog\Test\Unit\Helper\Product; +use Magento\Framework\App\Action\Action; + /** * Class CompareTest */ @@ -41,12 +43,17 @@ class CompareTest extends \PHPUnit_Framework_TestCase */ protected $urlEncoder; + /** + * @var \Magento\Catalog\Model\Session | \PHPUnit_Framework_MockObject_MockObject + */ + protected $catalogSessionMock; + public function setUp() { $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->urlBuilder = $this->getMock('Magento\Framework\Url', ['getUrl'], [], '', false); - $this->request = $this->getMock('Magento\Framework\App\Request\Http', ['getServer'], [], '', false); + $this->request = $this->getMock('Magento\Framework\App\Request\Http', ['getServer', 'isSecure'], [], '', false); /** @var \Magento\Framework\App\Helper\Context $context */ $this->context = $this->getMock( 'Magento\Framework\App\Helper\Context', @@ -58,7 +65,9 @@ class CompareTest extends \PHPUnit_Framework_TestCase $this->urlEncoder = $this->getMockBuilder('Magento\Framework\Url\EncoderInterface')->getMock(); $this->urlEncoder->expects($this->any()) ->method('encode') - ->will($this->returnArgument(0)); + ->willReturnCallback(function ($url) { + return strtr(base64_encode($url), '+/=', '-_,'); + }); $this->context->expects($this->once()) ->method('getUrlBuilder') ->will($this->returnValue($this->urlBuilder)); @@ -75,10 +84,21 @@ class CompareTest extends \PHPUnit_Framework_TestCase '', false ); + $this->catalogSessionMock = $this->getMock( + '\Magento\Catalog\Model\Session', + ['getBeforeCompareUrl'], + [], + '', + false + ); $this->compareHelper = $objectManager->getObject( 'Magento\Catalog\Helper\Product\Compare', - ['context' => $this->context, 'postHelper' => $this->postDataHelper] + [ + 'context' => $this->context, + 'postHelper' => $this->postDataHelper, + 'catalogSession' => $this->catalogSessionMock + ] ); } @@ -89,7 +109,7 @@ class CompareTest extends \PHPUnit_Framework_TestCase $removeUrl = 'catalog/product_compare/remove'; $compareListUrl = 'catalog/product_compare'; $postParams = [ - \Magento\Framework\App\Action\Action::PARAM_NAME_URL_ENCODED => $compareListUrl, + Action::PARAM_NAME_URL_ENCODED => strtr(base64_encode($compareListUrl), '+/=', '-_,'), 'product' => $productId ]; @@ -136,7 +156,7 @@ class CompareTest extends \PHPUnit_Framework_TestCase $refererUrl = 'home/'; $clearUrl = 'catalog/product_compare/clear'; $postParams = [ - \Magento\Framework\App\Action\Action::PARAM_NAME_URL_ENCODED => $refererUrl + Action::PARAM_NAME_URL_ENCODED => strtr(base64_encode($refererUrl), '+/=', '-_,') ]; //Verification @@ -157,4 +177,27 @@ class CompareTest extends \PHPUnit_Framework_TestCase $this->assertTrue($this->compareHelper->getPostDataClearList()); } + + public function testGetAddToCartUrl() + { + $productId = 42; + $isRequestSecure = false; + $beforeCompareUrl = 'http://magento.com/compare/before'; + $encodedCompareUrl = strtr(base64_encode($beforeCompareUrl), '+/=', '-_,'); + $expectedResult = [ + 'product' => $productId, + Action::PARAM_NAME_URL_ENCODED => $encodedCompareUrl, + '_secure' => $isRequestSecure + ]; + + $productMock = $this->getMock('\Magento\Catalog\Model\Product', [], [], '', false); + $this->catalogSessionMock->expects($this->once())->method('getBeforeCompareUrl')->willReturn($beforeCompareUrl); + $productMock->expects($this->once())->method('getId')->willReturn($productId); + $this->urlEncoder->expects($this->once())->method('encode')->with($beforeCompareUrl) + ->willReturn($encodedCompareUrl); + $this->request->expects($this->once())->method('isSecure')->willReturn($isRequestSecure); + + $this->urlBuilder->expects($this->once())->method('getUrl')->with('checkout/cart/add', $expectedResult); + $this->compareHelper->getAddToCartUrl($productMock); + } } diff --git a/app/code/Magento/Checkout/Block/Checkout/TotalsProcessor.php b/app/code/Magento/Checkout/Block/Checkout/TotalsProcessor.php index af5a8a51dd456490a1e1f66329cb1f83f94cc088..40438aaa6e9ffe101f37d87fef2737ed21ffe0f6 100644 --- a/app/code/Magento/Checkout/Block/Checkout/TotalsProcessor.php +++ b/app/code/Magento/Checkout/Block/Checkout/TotalsProcessor.php @@ -31,7 +31,8 @@ class TotalsProcessor implements \Magento\Checkout\Block\Checkout\LayoutProcesso public function process($jsLayout) { $configData = $this->scopeConfig->getValue('sales/totals_sort'); - $totals = $jsLayout['components']['checkout']['children']['summary']['children']['totals']['children']; + $totals = $jsLayout['components']['checkout']['children']['sidebar']['children']['summary'] + ['children']['totals']['children']; foreach ($totals as $code => &$total) { //convert JS naming style to config naming style $code = str_replace('-', '_', $code); @@ -39,8 +40,9 @@ class TotalsProcessor implements \Magento\Checkout\Block\Checkout\LayoutProcesso $total['sortOrder'] = $configData[$code]; } } - $jsLayout['components']['checkout']['children']['summary']['children']['totals']['children'] = $totals; + $jsLayout['components']['checkout']['children']['sidebar']['children']['summary'] + ['children']['totals']['children'] = $totals; - return array_merge_recursive($jsLayout, $totals); + return $jsLayout; } } diff --git a/app/code/Magento/Checkout/Controller/Index/Index.php b/app/code/Magento/Checkout/Controller/Index/Index.php index 518ae5e30eba92474f64ef5c3561dbd43b375a98..0bb9c2fe851046dd4a7c83acd49b6c00af68702e 100644 --- a/app/code/Magento/Checkout/Controller/Index/Index.php +++ b/app/code/Magento/Checkout/Controller/Index/Index.php @@ -15,6 +15,7 @@ class Index extends \Magento\Checkout\Controller\Onepage */ public function execute() { + /** @var \Magento\Checkout\Helper\Data $checkoutHelper */ $checkoutHelper = $this->_objectManager->get('Magento\Checkout\Helper\Data'); if (!$checkoutHelper->canOnepageCheckout()) { $this->messageManager->addError(__('One-page checkout is turned off.')); @@ -22,13 +23,12 @@ class Index extends \Magento\Checkout\Controller\Onepage } $quote = $this->getOnepage()->getQuote(); - - if (!$this->_customerSession->isLoggedIn() && !$checkoutHelper->isAllowedGuestCheckout($quote)) { - $this->messageManager->addError(__('Guest checkout is disabled.')); + if (!$quote->hasItems() || $quote->getHasError() || !$quote->validateMinimumAmount()) { return $this->resultRedirectFactory->create()->setPath('checkout/cart'); } - if (!$quote->hasItems() || $quote->getHasError() || !$quote->validateMinimumAmount()) { + if (!$this->_customerSession->isLoggedIn() && !$checkoutHelper->isAllowedGuestCheckout($quote)) { + $this->messageManager->addError(__('Guest checkout is disabled.')); return $this->resultRedirectFactory->create()->setPath('checkout/cart'); } diff --git a/app/code/Magento/Checkout/Helper/Cart.php b/app/code/Magento/Checkout/Helper/Cart.php index 4a8d760741e95484097a4140fe0db367750b63bf..b1443034b73a932988807801137b11ac19ce9299 100644 --- a/app/code/Magento/Checkout/Helper/Cart.php +++ b/app/code/Magento/Checkout/Helper/Cart.php @@ -77,7 +77,11 @@ class Cart extends \Magento\Framework\Url\Helper\Data $continueUrl = $this->urlEncoder->encode($this->_urlBuilder->getCurrentUrl()); $urlParamName = \Magento\Framework\App\Action\Action::PARAM_NAME_URL_ENCODED; - $routeParams = [$urlParamName => $continueUrl, 'product' => $product->getEntityId()]; + $routeParams = [ + $urlParamName => $continueUrl, + 'product' => $product->getEntityId(), + '_secure' => $this->_getRequest()->isSecure() + ]; if (!empty($additional)) { $routeParams = array_merge($routeParams, $additional); diff --git a/app/code/Magento/Checkout/Model/ShippingInformationManagement.php b/app/code/Magento/Checkout/Model/ShippingInformationManagement.php index 554caf8aa1c714fbbe47157aefa4dd2a6268044f..2c07db0239885e4db5118a56b38fed1b411eea64 100644 --- a/app/code/Magento/Checkout/Model/ShippingInformationManagement.php +++ b/app/code/Magento/Checkout/Model/ShippingInformationManagement.php @@ -109,7 +109,6 @@ class ShippingInformationManagement implements \Magento\Checkout\Api\ShippingInf $this->validateQuote($quote); $saveInAddressBook = $address->getSaveInAddressBook() ? 1 : 0; - $sameAsBilling = $address->getSameAsBilling() ? 1 : 0; $customerAddressId = $address->getCustomerAddressId(); $this->addressValidator->validate($address); $quote->setShippingAddress($address); @@ -119,7 +118,7 @@ class ShippingInformationManagement implements \Magento\Checkout\Api\ShippingInf $addressData = $this->addressRepository->getById($customerAddressId); $address = $quote->getShippingAddress()->importCustomerAddressData($addressData); } - $address->setSameAsBilling($sameAsBilling); + $address->setSaveInAddressBook($saveInAddressBook); $address->setCollectShippingRates(true); diff --git a/app/code/Magento/Checkout/Test/Unit/Block/Cart/SidebarTest.php b/app/code/Magento/Checkout/Test/Unit/Block/Cart/SidebarTest.php index d212eec3a5a7e8415d4e875a4cfea563c2dc7bb7..07131d91d63c3b5bdeeaa01ed5b4d8d97a6d8e37 100644 --- a/app/code/Magento/Checkout/Test/Unit/Block/Cart/SidebarTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Block/Cart/SidebarTest.php @@ -10,9 +10,82 @@ class SidebarTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */ protected $_objectManager; + /** + * @var \Magento\Checkout\Block\Cart\Sidebar + */ + protected $model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $layoutMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $urlBuilderMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $storeManagerMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $viewMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $scopeConfigMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $checkoutSessionMock; + protected function setUp() { $this->_objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + + $this->layoutMock = $this->getMock('\Magento\Framework\View\Layout', [], [], '', false); + $this->checkoutSessionMock = $this->getMock('\Magento\Checkout\Model\Session', [], [], '', false); + $this->urlBuilderMock = $this->getMock('\Magento\Framework\UrlInterface', [], [], '', false); + $this->storeManagerMock = $this->getMock('\Magento\Store\Model\StoreManagerInterface', [], [], '', false); + $this->viewMock = $this->getMock('\Magento\Catalog\Model\Product\Image\View', [], [], '', false); + $this->scopeConfigMock = $this->getMock( + '\Magento\Framework\App\Config\ScopeConfigInterface', + [], + [], + '', + false + ); + + $contextMock = $this->getMock( + '\Magento\Framework\View\Element\Template\Context', + ['getLayout', 'getUrlBuilder', 'getStoreManager', 'getScopeConfig'], + [], + '', + false + ); + $contextMock->expects($this->once()) + ->method('getLayout') + ->will($this->returnValue($this->layoutMock)); + $contextMock->expects($this->once()) + ->method('getUrlBuilder') + ->will($this->returnValue($this->urlBuilderMock)); + $contextMock->expects($this->once()) + ->method('getStoreManager') + ->will($this->returnValue($this->storeManagerMock)); + $contextMock->expects($this->once()) + ->method('getScopeConfig') + ->will($this->returnValue($this->scopeConfigMock)); + + $this->model = $this->_objectManager->getObject( + 'Magento\Checkout\Block\Cart\Sidebar', + ['context' => $contextMock, 'imageView' => $this->viewMock, 'checkoutSession' => $this->checkoutSessionMock] + ); } public function testGetTotalsHtml() @@ -27,30 +100,76 @@ class SidebarTest extends \PHPUnit_Framework_TestCase ->method('toHtml') ->will($this->returnValue($totalsHtml)); - $layoutMock = $this->getMockBuilder('\Magento\Framework\View\Layout') - ->disableOriginalConstructor() - ->getMock(); - - $layoutMock->expects($this->once()) + $this->layoutMock->expects($this->once()) ->method('getBlock') ->with('checkout.cart.minicart.totals') ->will($this->returnValue($totalsBlockMock)); - $contextMock = $this->getMockBuilder('\Magento\Framework\View\Element\Template\Context') - ->disableOriginalConstructor() - ->setMethods(['getLayout']) - ->getMock(); + $this->assertEquals($totalsHtml, $this->model->getTotalsHtml()); + } - $contextMock->expects($this->once()) - ->method('getLayout') - ->will($this->returnValue($layoutMock)); + public function testGetConfig() + { + $storeMock = $this->getMock('\Magento\Store\Model\Store', [], [], '', false); - /** @var \Magento\Checkout\Block\Cart\Sidebar $sidebarBlock */ - $sidebarBlock = $this->_objectManager->getObject( - 'Magento\Checkout\Block\Cart\Sidebar', - ['context' => $contextMock] - ); + $shoppingCartUrl = 'http://url.com/cart'; + $checkoutUrl = 'http://url.com/checkout'; + $updateItemQtyUrl = 'http://url.com/updateItemQty'; + $removeItemUrl = 'http://url.com/removeItem'; + $customerRegisterUrl = 'http://url.com/register'; + $customerForgotPasswordUrl = 'http://url.com/forgot'; + $baseUrl = 'http://url.com/'; + $imageTemplate = 'Magento_Catalog/product/image_with_borders'; + + $expectedResult = [ + 'shoppingCartUrl' => $shoppingCartUrl, + 'checkoutUrl' => $checkoutUrl, + 'updateItemQtyUrl' => $updateItemQtyUrl, + 'removeItemUrl' => $removeItemUrl, + 'imageTemplate' => $imageTemplate, + 'customerRegisterUrl' => $customerRegisterUrl, + 'customerForgotPasswordUrl' => $customerForgotPasswordUrl, + 'baseUrl' => $baseUrl + ]; + + $valueMap = [ + ['checkout/cart', [], $shoppingCartUrl], + ['checkout', [], $checkoutUrl], + ['checkout/sidebar/updateItemQty', [], $updateItemQtyUrl], + ['checkout/sidebar/removeItem', [], $removeItemUrl], + ['customer/account/create', [], $customerRegisterUrl], + ['customer/account/forgotpassword', [], $customerForgotPasswordUrl] + ]; + + $this->urlBuilderMock->expects($this->exactly(6)) + ->method('getUrl') + ->willReturnMap($valueMap); + $this->storeManagerMock->expects($this->once())->method('getStore')->willReturn($storeMock); + $storeMock->expects($this->once())->method('getBaseUrl')->willReturn($baseUrl); + $this->viewMock->expects($this->once())->method('isWhiteBorders')->willReturn(false); + + $this->assertEquals($expectedResult, $this->model->getConfig()); + } + + public function testGetIsNeedToDisplaySideBar() + { + $this->scopeConfigMock->expects($this->once()) + ->method('getValue') + ->with( + \Magento\Checkout\Block\Cart\Sidebar::XML_PATH_CHECKOUT_SIDEBAR_DISPLAY, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + )->willReturn(true); + + $this->assertTrue($this->model->getIsNeedToDisplaySideBar()); + } + + public function testGetTotalsCache() + { + $quoteMock = $this->getMock('\Magento\Quote\Model\Quote', [], [], '', false); + $totalsMock = ['totals']; + $this->checkoutSessionMock->expects($this->once())->method('getQuote')->willReturn($quoteMock); + $quoteMock->expects($this->once())->method('getTotals')->willReturn($totalsMock); - $this->assertEquals($totalsHtml, $sidebarBlock->getTotalsHtml()); + $this->assertEquals($totalsMock, $this->model->getTotalsCache()); } } diff --git a/app/code/Magento/Checkout/Test/Unit/Block/Checkout/TotalsProcessorTest.php b/app/code/Magento/Checkout/Test/Unit/Block/Checkout/TotalsProcessorTest.php new file mode 100644 index 0000000000000000000000000000000000000000..5d276d56991fcf1adfc07f18f97eaf5ecfee3df3 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Unit/Block/Checkout/TotalsProcessorTest.php @@ -0,0 +1,55 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Checkout\Test\Unit\Block\Checkout; + +class TotalsProcessorTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Checkout\Block\Checkout\TotalsProcessor + */ + protected $model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $scopeConfigMock; + + public function setUp() + { + $this->scopeConfigMock = $this->getMock( + '\Magento\Framework\App\Config\ScopeConfigInterface', + [], + [], + '', + false + ); + + $this->model = new \Magento\Checkout\Block\Checkout\TotalsProcessor($this->scopeConfigMock); + } + + public function testProcess() + { + $jsLayout['components']['checkout']['children']['sidebar']['children']['summary'] + ['children']['totals']['children'] = [ + 'sub-total' => [], + 'grand-total' => [], + 'non-existant-total' => null + ]; + $expectedResult['components']['checkout']['children']['sidebar']['children']['summary'] + ['children']['totals']['children'] = [ + 'sub-total' => ['sortOrder' => 10], + 'grand-total' => ['sortOrder' => 20], + 'non-existant-total' => null + ]; + $configData = ['sub_total' => 10, 'grand_total' => 20]; + + $this->scopeConfigMock->expects($this->once())->method('getValue')->with('sales/totals_sort') + ->willReturn($configData); + + $this->assertEquals($expectedResult, $this->model->process($jsLayout)); + } +} diff --git a/app/code/Magento/Checkout/Test/Unit/CustomerData/CartTest.php b/app/code/Magento/Checkout/Test/Unit/CustomerData/CartTest.php new file mode 100644 index 0000000000000000000000000000000000000000..0be9fef0be532f366fb612eacd46fff50b7b81dd --- /dev/null +++ b/app/code/Magento/Checkout/Test/Unit/CustomerData/CartTest.php @@ -0,0 +1,80 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Checkout\Test\Unit\CustomerData; + +class CartTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Checkout\CustomerData\Cart + */ + protected $model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $checkoutSessionMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $catalogUrlMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $checkoutCartMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $checkoutHelperMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $itemPoolInterfaceMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $layoutMock; + + public function setUp() + { + $this->checkoutSessionMock = $this->getMock('\Magento\Checkout\Model\Session', [], [], '', false); + $this->catalogUrlMock = $this->getMock('\Magento\Catalog\Model\Resource\Url', [], [], '', false); + $this->checkoutCartMock = $this->getMock('\Magento\Checkout\Model\Cart', [], [], '', false); + $this->checkoutHelperMock = $this->getMock('\Magento\Checkout\Helper\Data', [], [], '', false); + $this->layoutMock = $this->getMock('\Magento\Framework\View\LayoutInterface', [], [], '', false); + $this->itemPoolInterfaceMock = $this->getMock( + '\Magento\Checkout\CustomerData\ItemPoolInterface', + [], + [], + '', + false + ); + + $this->model = new \Magento\Checkout\CustomerData\Cart( + $this->checkoutSessionMock, + $this->catalogUrlMock, + $this->checkoutCartMock, + $this->checkoutHelperMock, + $this->itemPoolInterfaceMock, + $this->layoutMock + ); + } + + public function testIsGuestCheckoutAllowed() + { + $quoteMock = $this->getMock('\Magento\Quote\Model\Quote', [], [], '', false); + $this->checkoutSessionMock->expects($this->once())->method('getQuote')->willReturn($quoteMock); + $this->checkoutHelperMock->expects($this->once())->method('isAllowedGuestCheckout')->with($quoteMock) + ->willReturn(true); + + $this->assertTrue($this->model->isGuestCheckoutAllowed()); + } +} diff --git a/app/code/Magento/Checkout/Test/Unit/Helper/CartTest.php b/app/code/Magento/Checkout/Test/Unit/Helper/CartTest.php index c33ef261f889ec82566c221084504591e3998875..b656c5d4206ce90fb27ed410237e81f666bfe4bb 100644 --- a/app/code/Magento/Checkout/Test/Unit/Helper/CartTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Helper/CartTest.php @@ -155,6 +155,7 @@ class CartTest extends \PHPUnit_Framework_TestCase { $productEntityId = 1; $storeId = 1; + $isRequestSecure = false; $productMock = $this->getMock('\Magento\Catalog\Model\Product', ['getEntityId', 'hasUrlDataObject', 'getUrlDataObject', '__wakeup'], [], '', false); $productMock->expects($this->any())->method('getEntityId')->will($this->returnValue($productEntityId)); @@ -167,6 +168,7 @@ class CartTest extends \PHPUnit_Framework_TestCase $this->requestMock->expects($this->any())->method('getRouteName')->will($this->returnValue('checkout')); $this->requestMock->expects($this->any())->method('getControllerName')->will($this->returnValue('cart')); + $this->requestMock->expects($this->once())->method('isSecure')->willReturn($isRequestSecure); $params = [ Action::PARAM_NAME_URL_ENCODED => strtr(base64_encode($currentUrl), '+/=', '-_,'), @@ -175,6 +177,7 @@ class CartTest extends \PHPUnit_Framework_TestCase '_scope' => $storeId, '_scope_to_url' => true, 'in_cart' => 1, + '_secure' => $isRequestSecure ]; $this->urlBuilderMock->expects($this->once())->method('getUrl')->with('checkout/cart/add', $params); diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml index f6a5ba13a84019150b28b0cd90a27f89dab22248..e8a974ee88cd59bdbcb6c545eba9391a9ba9a803 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml @@ -55,6 +55,9 @@ <item name="displayArea" xsi:type="string">estimation</item> <item name="config" xsi:type="array"> <item name="template" xsi:type="string">Magento_Checkout/estimation</item> + <item name="deps" xsi:type="array"> + <item name="0" xsi:type="string">checkout.sidebar</item> + </item> </item> </item> <item name="steps" xsi:type="array"> @@ -299,89 +302,99 @@ </item> </item> </item> - <item name="summary" xsi:type="array"> - <item name="component" xsi:type="string">Magento_Checkout/js/view/summary</item> - <item name="displayArea" xsi:type="string">summary</item> + <item name="sidebar" xsi:type="array"> + <item name="sortOrder" xsi:type="string">50</item> + <item name="component" xsi:type="string">Magento_Checkout/js/view/sidebar</item> + <item name="displayArea" xsi:type="string">sidebar</item> <item name="config" xsi:type="array"> - <item name="template" xsi:type="string">Magento_Checkout/summary</item> + <item name="template" xsi:type="string">Magento_Checkout/sidebar</item> </item> <item name="children" xsi:type="array"> - <item name="totals" xsi:type="array"> - <item name="component" xsi:type="string">uiComponent</item> - <item name="displayArea" xsi:type="string">totals</item> + <item name="summary" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Checkout/js/view/summary</item> + <item name="displayArea" xsi:type="string">summary</item> <item name="config" xsi:type="array"> - <item name="template" xsi:type="string">Magento_Checkout/summary/totals</item> + <item name="template" xsi:type="string">Magento_Checkout/summary</item> </item> <item name="children" xsi:type="array"> - <!-- sort order for this totals is configured on admin panel--> - <!-- Stores->Configuration->SALES->Sales->General->Checkout Totals Sort Order --> - <item name="subtotal" xsi:type="array"> - <item name="component" xsi:type="string">Magento_Checkout/js/view/summary/subtotal</item> + <item name="totals" xsi:type="array"> + <item name="component" xsi:type="string">uiComponent</item> + <item name="displayArea" xsi:type="string">totals</item> <item name="config" xsi:type="array"> - <item name="title" xsi:type="string">Cart Subtotal</item> + <item name="template" xsi:type="string">Magento_Checkout/summary/totals</item> </item> - </item> - <item name="shipping" xsi:type="array"> - <item name="component" xsi:type="string">Magento_Checkout/js/view/summary/shipping</item> - <item name="config" xsi:type="array"> - <item name="title" xsi:type="string">Shipping</item> - <item name="notCalculatedMessage" xsi:type="string">Not yet calculated</item> + <item name="children" xsi:type="array"> + <!-- sort order for this totals is configured on admin panel--> + <!-- Stores->Configuration->SALES->Sales->General->Checkout Totals Sort Order --> + <item name="subtotal" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Checkout/js/view/summary/subtotal</item> + <item name="config" xsi:type="array"> + <item name="title" xsi:type="string">Cart Subtotal</item> + </item> + </item> + <item name="shipping" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Checkout/js/view/summary/shipping</item> + <item name="config" xsi:type="array"> + <item name="title" xsi:type="string">Shipping</item> + <item name="notCalculatedMessage" xsi:type="string">Not yet calculated</item> + </item> + </item> + <item name="grand-total" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Checkout/js/view/summary/grand-total</item> + <item name="config" xsi:type="array"> + <item name="title" xsi:type="string">Order Total</item> + </item> + </item> </item> </item> - <item name="grand-total" xsi:type="array"> - <item name="component" xsi:type="string">Magento_Checkout/js/view/summary/grand-total</item> - <item name="config" xsi:type="array"> - <item name="title" xsi:type="string">Order Total</item> + <item name="itemsBefore" xsi:type="array"> + <item name="component" xsi:type="string">uiComponent</item> + <item name="children" xsi:type="array"> + <!-- merge your components here --> </item> </item> - </item> - </item> - <item name="itemsBefore" xsi:type="array"> - <item name="component" xsi:type="string">uiComponent</item> - <item name="children" xsi:type="array"> - <!-- merge your components here --> - </item> - </item> - <item name="cart_items" xsi:type="array"> - <item name="component" xsi:type="string">Magento_Checkout/js/view/summary/cart-items</item> - <item name="children" xsi:type="array"> - <item name="details" xsi:type="array"> - <item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details</item> + <item name="cart_items" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Checkout/js/view/summary/cart-items</item> <item name="children" xsi:type="array"> - <item name="thumbnail" xsi:type="array"> - <item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details/thumbnail</item> - <item name="displayArea" xsi:type="string">before_details</item> - </item> - <item name="subtotal" xsi:type="array"> - <item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details/subtotal</item> - <item name="displayArea" xsi:type="string">after_details</item> + <item name="details" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details</item> + <item name="children" xsi:type="array"> + <item name="thumbnail" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details/thumbnail</item> + <item name="displayArea" xsi:type="string">before_details</item> + </item> + <item name="subtotal" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Checkout/js/view/summary/item/details/subtotal</item> + <item name="displayArea" xsi:type="string">after_details</item> + </item> + </item> </item> + + </item> + </item> + <item name="itemsAfter" xsi:type="array"> + <item name="component" xsi:type="string">uiComponent</item> + <item name="children" xsi:type="array"> + <!-- merge your components here --> </item> </item> - </item> </item> - <item name="itemsAfter" xsi:type="array"> - <item name="component" xsi:type="string">uiComponent</item> + <item name="shipping-information" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Checkout/js/view/shipping-information</item> + <item name="config" xsi:type="array"> + <item name="deps" xsi:type="string">checkout.steps.shipping-step.shippingAddress</item> + </item> + <item name="displayArea" xsi:type="string">shipping-information</item> <item name="children" xsi:type="array"> - <!-- merge your components here --> + <item name="ship-to" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Checkout/js/view/shipping-information/list</item> + <item name="displayArea" xsi:type="string">ship-to</item> + </item> </item> </item> </item> </item> - <item name="shipping-information" xsi:type="array"> - <item name="component" xsi:type="string">Magento_Checkout/js/view/shipping-information</item> - <item name="config" xsi:type="array"> - <item name="deps" xsi:type="string">checkout.steps.shipping-step.shippingAddress</item> - </item> - <item name="displayArea" xsi:type="string">shipping-information</item> - <item name="children" xsi:type="array"> - <item name="ship-to" xsi:type="array"> - <item name="component" xsi:type="string">Magento_Checkout/js/view/shipping-information/list</item> - <item name="displayArea" xsi:type="string">ship-to</item> - </item> - </item> - </item> </item> </item> <item name="checkoutProvider" xsi:type="array"> diff --git a/app/code/Magento/Checkout/view/frontend/web/js/action/select-billing-address.js b/app/code/Magento/Checkout/view/frontend/web/js/action/select-billing-address.js index da290fc1aa214d38d38deb8ca5b68805e66962f5..478dc2f29e4b40b725f4d1067f3369af6260c1d7 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/action/select-billing-address.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/action/select-billing-address.js @@ -5,12 +5,20 @@ /*global define*/ define( [ + 'jquery', '../model/quote' ], - function(quote) { + function($, quote) { "use strict"; return function(billingAddress) { - quote.billingAddress(billingAddress); + var address = null; + if (billingAddress.getCacheKey() == quote.shippingAddress().getCacheKey()) { + address = $.extend({}, billingAddress); + address.save_in_address_book = false; + } else { + address = billingAddress; + } + quote.billingAddress(address); }; } ); diff --git a/app/code/Magento/Checkout/view/frontend/web/js/action/select-shipping-address.js b/app/code/Magento/Checkout/view/frontend/web/js/action/select-shipping-address.js index a8d1e6d38be27d054ca80636f988009ff66e87fb..db5bd93b275a69fb0d8a8bfa2f99540315bbb8f4 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/action/select-shipping-address.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/action/select-shipping-address.js @@ -4,11 +4,13 @@ */ /*global define*/ define( - ['../model/quote', - 'Magento_Checkout/js/model/shipping-rate-service' + [ + '../model/quote', + 'Magento_Checkout/js/model/shipping-rate-service', + 'Magento_Checkout/js/action/select-billing-address' ], - function(quote, shippingRateService) { - "use strict"; + function(quote, shippingRateService, selectBillingAddress) { + 'use strict'; quote.shippingAddress.subscribe(function () { shippingRateService.getRates(quote.shippingAddress()) }); @@ -16,7 +18,7 @@ define( quote.shippingAddress(shippingAddress); //set billing address same as shipping by default if it is not empty if (shippingAddress.countryId != undefined && shippingAddress.canUseForBilling()) { - quote.billingAddress(shippingAddress); + selectBillingAddress(quote.shippingAddress()); } }; } diff --git a/app/code/Magento/Checkout/view/frontend/web/js/model/sidebar.js b/app/code/Magento/Checkout/view/frontend/web/js/model/sidebar.js new file mode 100644 index 0000000000000000000000000000000000000000..8241561babfc89cc3bc023d8ddd684d24a9f3339 --- /dev/null +++ b/app/code/Magento/Checkout/view/frontend/web/js/model/sidebar.js @@ -0,0 +1,28 @@ +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +/*jshint browser:true jquery:true*/ +/*global alert*/ +define( + [], + function() { + 'use strict'; + return { + popUp: false, + setPopup: function(popUp) { + this.popUp = popUp; + }, + show: function() { + if (this.popUp) { + this.popUp.modal('openModal'); + } + }, + hide: function() { + if (this.popUp) { + this.popUp.modal('closeModal'); + } + } + }; + } +); diff --git a/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js b/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js index d6cef062b1d507b82fcc00b5ee99fbc128d533a5..f4c2213022caf49f888f5155a94e41a81948c83c 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/region-updater.js @@ -194,7 +194,7 @@ define([ if (this.options.isZipRequired) { $.inArray(country, this.options.countriesWithOptionalZip) >= 0 ? postcode.removeClass('required-entry').closest('.field').removeClass('required') : - postcode.removeClass('required-entry').closest('.field').addClass('required'); + postcode.addClass('required-entry').closest('.field').addClass('required'); } // Add defaultvalue attribute to state/province select element diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js index 945cd2802754e39b92161091615b8e09e3ad0e4e..95f20afa7264e5bfde04db6ed8c334e371b62c84 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js @@ -50,10 +50,16 @@ define( isAddressFormVisible: !customer.isLoggedIn() || addressOptions.length == 1, isAddressSameAsShipping: false }); + quote.billingAddress.subscribe(function(newAddress) { - this.isAddressSameAsShipping(newAddress == quote.shippingAddress() && !quote.isVirtual()); + this.isAddressSameAsShipping( + newAddress != null + && newAddress.getCacheKey() == quote.shippingAddress().getCacheKey() + && !quote.isVirtual() + ); this.isAddressDetailsVisible(true); }, this); + return this; }, @@ -117,7 +123,9 @@ define( if (quote.billingAddress()) { // restore 'Same As Shipping' checkbox state this.isAddressSameAsShipping( - !quote.isVirtual() && (quote.shippingAddress() == quote.billingAddress()) + quote.billingAddress() != null + && quote.billingAddress().getCacheKey() == quote.shippingAddress().getCacheKey() + && !quote.isVirtual() ); this.isAddressDetailsVisible(true); } diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/estimation.js b/app/code/Magento/Checkout/view/frontend/web/js/view/estimation.js index 23babcd44d8f9f1f7d870db9683ea771b6ab477d..76e34d4cbf5207e185eeb395a7284c37e8dbcac4 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/estimation.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/estimation.js @@ -4,10 +4,13 @@ */ define( [ - 'Magento_Checkout/js/view/summary/abstract-total', - 'Magento_Checkout/js/model/totals' + 'uiComponent', + 'Magento_Checkout/js/model/quote', + 'Magento_Catalog/js/price-utils', + 'Magento_Checkout/js/model/totals', + 'Magento_Checkout/js/model/sidebar' ], - function (Component, totals) { + function (Component, quote, priceUtils, totals, sidebarModel) { 'use strict'; return Component.extend({ getQuantity: function() { @@ -22,6 +25,12 @@ define( } return 0; }, + showSidebar: function() { + sidebarModel.show(); + }, + getFormattedPrice: function (price) { + return priceUtils.formatPrice(price, quote.getPriceFormat()); + }, getValue: function () { return this.getFormattedPrice(this.getPureValue()); } diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping-information.js b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping-information.js index d33dd69762f9ca3fab4c12c0ea05108d91e61764..c5b863d51da64ac421f35bafd2c2fe50121c3776 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping-information.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping-information.js @@ -10,9 +10,10 @@ define( 'uiComponent', 'Magento_Checkout/js/model/quote', 'Magento_Checkout/js/model/shipping-service', - 'Magento_Checkout/js/model/step-navigator' + 'Magento_Checkout/js/model/step-navigator', + 'Magento_Checkout/js/model/sidebar' ], - function($, Component, quote, shippingService, stepNavigator) { + function($, Component, quote, shippingService, stepNavigator, sidebarModel) { 'use strict'; return Component.extend({ defaults: { @@ -28,8 +29,7 @@ define( }, back: function() { - // Temp solution for closing summary sliding panel on mobile MAGETWO-3864 - $('#opc-sidebar').modal('toggleModal'); + sidebarModel.hide(); stepNavigator.back(); } }); diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/sidebar.js b/app/code/Magento/Checkout/view/frontend/web/js/view/sidebar.js new file mode 100644 index 0000000000000000000000000000000000000000..2f6161d4abd79c644bc051165f70eb6678fef524 --- /dev/null +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/sidebar.js @@ -0,0 +1,21 @@ +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +/*global define*/ +define( + [ + 'uiComponent', + 'ko', + 'jquery', + 'Magento_Checkout/js/model/sidebar' + ], + function(Component, ko, $, sidebarModel) { + 'use strict'; + return Component.extend({ + setModalElement: function(element) { + sidebarModel.setPopup($(element)); + } + }); + } +); diff --git a/app/code/Magento/Checkout/view/frontend/web/template/estimation.html b/app/code/Magento/Checkout/view/frontend/web/template/estimation.html index cf7da50e0af9248969c207b40e64788af554f8cd..af295c6f0f3b371334d244c9b61bbfa05197fb1f 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/estimation.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/estimation.html @@ -7,10 +7,10 @@ <div class="opc-estimated-wrapper"> <div class="estimated-block"> <span class="estimated-label" data-bind="text: $t('Estimated Total')"></span> - <span class="estimated-price" data-bind="text: getValue()">$120.00</span> + <span class="estimated-price" data-bind="text: getValue()"></span> </div> <div class="minicart-wrapper"> - <button type="button" class="action showcart" data-toggle="opc-summary"> + <button type="button" class="action showcart" data-bind="click: showSidebar" data-toggle="opc-summary"> <span class="counter qty"> <span class="counter-number" data-bind="text: getQuantity()"></span> </span> diff --git a/app/code/Magento/Checkout/view/frontend/web/template/onepage.html b/app/code/Magento/Checkout/view/frontend/web/template/onepage.html index 13e7c4933c0def245a4a8047455518df29fdbbc1..0df95eee0b454f946253359b2fa4a9b12f477317 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/onepage.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/onepage.html @@ -27,27 +27,6 @@ </ol> </div> -<div id="opc-sidebar" - data-bind="mageInit: { - 'Magento_Ui/js/modal/modal':{ - 'type': 'custom', - 'modalClass': 'opc-sidebar opc-summary-wrapper', - 'trigger': '[data-toggle=opc-summary]', - 'wrapperClass': 'checkout-container', - 'parentModalClass': '_has-modal-custom', - 'responsive': true, - 'responsiveClass': 'custom-slide', - 'overlayClass': 'modal-custom-overlay', - 'buttons': [] - }}"> - - <!-- ko foreach: getRegion('summary') --> - <!-- ko template: getTemplate() --><!-- /ko --> - <!--/ko--> - - <div class="opc-block-shipping-information"> - <!-- ko foreach: getRegion('shipping-information') --> - <!-- ko template: getTemplate() --><!-- /ko --> - <!--/ko--> - </div> -</div> +<!-- ko foreach: getRegion('sidebar') --> + <!-- ko template: getTemplate() --><!-- /ko --> +<!--/ko--> diff --git a/app/code/Magento/Checkout/view/frontend/web/template/sidebar.html b/app/code/Magento/Checkout/view/frontend/web/template/sidebar.html new file mode 100644 index 0000000000000000000000000000000000000000..ac187a3b8cd69cb64ed4104d73f3751af37b44ca --- /dev/null +++ b/app/code/Magento/Checkout/view/frontend/web/template/sidebar.html @@ -0,0 +1,30 @@ +<!-- +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<div id="opc-sidebar" + data-bind="afterRender:setModalElement, mageInit: { + 'Magento_Ui/js/modal/modal':{ + 'type': 'custom', + 'modalClass': 'opc-sidebar opc-summary-wrapper', + 'wrapperClass': 'checkout-container', + 'parentModalClass': '_has-modal-custom', + 'responsive': true, + 'responsiveClass': 'custom-slide', + 'overlayClass': 'modal-custom-overlay', + 'buttons': [] + }}"> + + <!-- ko foreach: getRegion('summary') --> + <!-- ko template: getTemplate() --><!-- /ko --> + <!--/ko--> + + <div class="opc-block-shipping-information"> + <!-- ko foreach: getRegion('shipping-information') --> + <!-- ko template: getTemplate() --><!-- /ko --> + <!--/ko--> + </div> +</div> diff --git a/app/code/Magento/Customer/view/frontend/web/js/model/customer/address.js b/app/code/Magento/Customer/view/frontend/web/js/model/customer/address.js index c3f656411450d8f6a9603d7688a93d5e8f788fd7..b10800641c443d9078eeb273f3757eb95aba745b 100644 --- a/app/code/Magento/Customer/view/frontend/web/js/model/customer/address.js +++ b/app/code/Magento/Customer/view/frontend/web/js/model/customer/address.js @@ -47,6 +47,9 @@ define([], function() { getKey: function() { return this.getType() + this.customerAddressId; }, + getCacheKey: function() { + return this.getKey(); + }, isEditable: function() { return false; }, diff --git a/app/code/Magento/Customer/view/frontend/web/template/customer-email.html b/app/code/Magento/Customer/view/frontend/web/template/customer-email.html index 558bb0a5b4d2e4a44daddefc803db0f27ec76f35..a2159cc764d2a6955f2fe8b79935f6a8253f163c 100644 --- a/app/code/Magento/Customer/view/frontend/web/template/customer-email.html +++ b/app/code/Magento/Customer/view/frontend/web/template/customer-email.html @@ -25,7 +25,7 @@ data-validate="{required:true, 'validate-email':true}" id="customer-email" /> <!-- ko template: 'ui/form/element/helper/tooltip' --><!-- /ko --> - <span class="note"><!-- ko text: $t("You can create an account after checkout.")--><!-- /ko --></span> + <span class="note" data-bind="fadeVisible: isPasswordVisible() == false"><!-- ko text: $t("You can create an account after checkout.")--><!-- /ko --></span> </div> </div> diff --git a/app/code/Magento/Payment/Model/Checks/CanUseForCountry.php b/app/code/Magento/Payment/Model/Checks/CanUseForCountry.php index 46e129662cc7859f315e00ab6207e12ceee599ba..749093370682541e2455a67b16ac8bed700937ad 100644 --- a/app/code/Magento/Payment/Model/Checks/CanUseForCountry.php +++ b/app/code/Magento/Payment/Model/Checks/CanUseForCountry.php @@ -7,9 +7,23 @@ namespace Magento\Payment\Model\Checks; use Magento\Payment\Model\MethodInterface; use Magento\Quote\Model\Quote; +use Magento\Payment\Model\Checks\CanUseForCountry\CountryProvider; class CanUseForCountry implements SpecificationInterface { + /** + * @var CountryProvider + */ + protected $countryProvider; + + /** + * @param CountryProvider $countryProvider + */ + public function __construct(CountryProvider $countryProvider) + { + $this->countryProvider = $countryProvider; + } + /** * Check whether payment method is applicable to quote * @param MethodInterface $paymentMethod @@ -18,6 +32,6 @@ class CanUseForCountry implements SpecificationInterface */ public function isApplicable(MethodInterface $paymentMethod, Quote $quote) { - return $paymentMethod->canUseForCountry($quote->getBillingAddress()->getCountry()); + return $paymentMethod->canUseForCountry($this->countryProvider->getCountry($quote)); } } diff --git a/app/code/Magento/Payment/Model/Checks/CanUseForCountry/CountryProvider.php b/app/code/Magento/Payment/Model/Checks/CanUseForCountry/CountryProvider.php new file mode 100644 index 0000000000000000000000000000000000000000..8bbdbef28307a9d0a8fd6ae8ef5d2f14808ed5a0 --- /dev/null +++ b/app/code/Magento/Payment/Model/Checks/CanUseForCountry/CountryProvider.php @@ -0,0 +1,38 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Payment\Model\Checks\CanUseForCountry; + +use Magento\Quote\Model\Quote; +use Magento\Directory\Helper\Data as DirectoryHelper; + +class CountryProvider +{ + /** + * @var DirectoryHelper + */ + protected $directoryHelper; + + /** + * @param DirectoryHelper $directoryHelper + */ + public function __construct(DirectoryHelper $directoryHelper) + { + $this->directoryHelper = $directoryHelper; + } + + /** + * Get payment country + * + * @param Quote $quote + * @return int + */ + public function getCountry(Quote $quote) + { + return $quote->isVirtual() + ? $this->directoryHelper->getDefaultCountry() + : $quote->getShippingAddress()->getCountry(); + } +} diff --git a/app/code/Magento/Payment/Test/Unit/Model/CcConfigProviderTest.php b/app/code/Magento/Payment/Test/Unit/Model/CcConfigProviderTest.php new file mode 100644 index 0000000000000000000000000000000000000000..217ac20644e7ee4816585056c0f23c51c7c611b3 --- /dev/null +++ b/app/code/Magento/Payment/Test/Unit/Model/CcConfigProviderTest.php @@ -0,0 +1,101 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Payment\Test\Unit\Model; + +class CcConfigProviderTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Payment\Model\CcConfigProvider + */ + protected $model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $ccConfigMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $assetSourceMock; + + protected function setUp() + { + $this->ccConfigMock = $this->getMock('\Magento\Payment\Model\CcConfig', [], [], '', false); + $this->assetSourceMock = $this->getMock('\Magento\Framework\View\Asset\Source', [], [], '', false); + $this->model = new \Magento\Payment\Model\CcConfigProvider( + $this->ccConfigMock, + $this->assetSourceMock + ); + } + + public function testGetConfig() + { + $imagesDirectoryPath = __DIR__ . '/../../../view/base/web/images/cc/'; + $expectedResult = [ + 'payment' => [ + 'ccform' => [ + 'icons' => [ + 'vi' => [ + 'url' => 'http://cc.card/vi.png', + 'width' => getimagesize($imagesDirectoryPath . 'vi.png')[0], + 'height' => getimagesize($imagesDirectoryPath . 'vi.png')[1] + ], + 'ae' => [ + 'url' => 'http://cc.card/ae.png', + 'width' => getimagesize($imagesDirectoryPath . 'ae.png')[0], + 'height' => getimagesize($imagesDirectoryPath . 'ae.png')[1] + ] + ] + ] + ] + ]; + + $ccAvailableTypesMock = [ + 'vi' => [ + 'fileId' => 'Magento_Payment::images/cc/vi.png', + 'path' => $imagesDirectoryPath . 'vi.png', + 'url' => 'http://cc.card/vi.png' + ], + 'ae' => [ + 'fileId' => 'Magento_Payment::images/cc/ae.png', + 'path' => $imagesDirectoryPath . 'ae.png', + 'url' => 'http://cc.card/ae.png' + ] + ]; + $assetMock = $this->getMock('\Magento\Framework\View\Asset\File', [], [], '', false); + + $this->ccConfigMock->expects($this->once())->method('getCcAvailableTypes')->willReturn($ccAvailableTypesMock); + + $this->ccConfigMock->expects($this->atLeastOnce()) + ->method('createAsset') + ->withConsecutive( + [$ccAvailableTypesMock['vi']['fileId']], + [$ccAvailableTypesMock['ae']['fileId']] + )->willReturn($assetMock); + $this->assetSourceMock->expects($this->atLeastOnce()) + ->method('findRelativeSourceFilePath') + ->with($assetMock) + ->willReturnOnConsecutiveCalls( + $ccAvailableTypesMock['vi']['path'], + $ccAvailableTypesMock['ae']['path'] + ); + $assetMock->expects($this->atLeastOnce()) + ->method('getSourceFile') + ->willReturnOnConsecutiveCalls( + $ccAvailableTypesMock['vi']['path'], + $ccAvailableTypesMock['ae']['path'] + ); + $assetMock->expects($this->atLeastOnce()) + ->method('getUrl') + ->willReturnOnConsecutiveCalls( + $ccAvailableTypesMock['vi']['url'], + $ccAvailableTypesMock['ae']['url'] + ); + + $this->assertEquals($expectedResult, $this->model->getConfig()); + } +} diff --git a/app/code/Magento/Payment/Test/Unit/Model/Checks/CanUseForCountry/CountryProviderTest.php b/app/code/Magento/Payment/Test/Unit/Model/Checks/CanUseForCountry/CountryProviderTest.php new file mode 100644 index 0000000000000000000000000000000000000000..13f1ad7d41451b30dc1e7c5a5fb8afab37d755e2 --- /dev/null +++ b/app/code/Magento/Payment/Test/Unit/Model/Checks/CanUseForCountry/CountryProviderTest.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © 2015 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Payment\Test\Unit\Model\Checks\CanUseForCountry; + +class CountryProviderTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Payment\Model\Checks\CanUseForCountry\CountryProvider + */ + protected $model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $directoryMock; + + public function setUp() + { + $this->directoryMock = $this->getMock('Magento\Directory\Helper\Data', [], [], '', false, false); + $this->model = new \Magento\Payment\Model\Checks\CanUseForCountry\CountryProvider($this->directoryMock); + } + + public function testGetCountryForNonVirtualQuote() + { + $quoteMock = $this->getMock('Magento\Quote\Model\Quote', [], [], '', false, false); + $quoteMock->expects($this->once())->method('isVirtual')->willReturn(false); + $addressMock = $this->getMock('Magento\Quote\Model\Quote\Address', [], [], '', false, false); + $addressMock->expects($this->once())->method('getCountry')->will($this->returnValue(1)); + $quoteMock->expects($this->once())->method('getShippingAddress')->will($this->returnValue($addressMock)); + $this->assertEquals(1, $this->model->getCountry($quoteMock)); + } + + public function testGetCountryForVirtualQuote() + { + $quoteMock = $this->getMock('Magento\Quote\Model\Quote', [], [], '', false, false); + $quoteMock->expects($this->once())->method('isVirtual')->willReturn(true); + $addressMock = $this->getMock('Magento\Quote\Model\Quote\Address', [], [], '', false, false); + $addressMock->expects($this->never())->method('getCountry'); + $quoteMock->expects($this->never())->method('getShippingAddress'); + $this->directoryMock->expects($this->once())->method('getDefaultCountry')->willReturn(10); + $this->assertEquals(10, $this->model->getCountry($quoteMock)); + } +} diff --git a/app/code/Magento/Payment/Test/Unit/Model/Checks/CanUseForCountryTest.php b/app/code/Magento/Payment/Test/Unit/Model/Checks/CanUseForCountryTest.php index c9f1407a98349f0e0ab3efc8f91895d60916ef3a..2df67ab234dd370438d7e419d529a18711ad1518 100644 --- a/app/code/Magento/Payment/Test/Unit/Model/Checks/CanUseForCountryTest.php +++ b/app/code/Magento/Payment/Test/Unit/Model/Checks/CanUseForCountryTest.php @@ -15,6 +15,11 @@ class CanUseForCountryTest extends \PHPUnit_Framework_TestCase */ const EXPECTED_COUNTRY_ID = 1; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $countryProvider; + /** * @var CanUseForCountry */ @@ -22,7 +27,15 @@ class CanUseForCountryTest extends \PHPUnit_Framework_TestCase public function setUp() { - $this->_model = new CanUseForCountry(); + $this->countryProvider = $this->getMock( + 'Magento\Payment\Model\Checks\CanUseForCountry\CountryProvider', + [], + [], + '', + false, + false + ); + $this->_model = new CanUseForCountry($this->countryProvider); } /** @@ -34,13 +47,6 @@ class CanUseForCountryTest extends \PHPUnit_Framework_TestCase $quoteMock = $this->getMockBuilder('Magento\Quote\Model\Quote')->disableOriginalConstructor()->setMethods( [] )->getMock(); - $billingAddressMock = $this->getMockBuilder( - 'Magento\Quote\Model\Quote\Address' - )->disableOriginalConstructor()->setMethods([])->getMock(); - $billingAddressMock->expects($this->once())->method('getCountry')->will( - $this->returnValue(self::EXPECTED_COUNTRY_ID) - ); - $quoteMock->expects($this->once())->method('getBillingAddress')->will($this->returnValue($billingAddressMock)); $paymentMethod = $this->getMockBuilder( '\Magento\Payment\Model\MethodInterface' @@ -48,6 +54,7 @@ class CanUseForCountryTest extends \PHPUnit_Framework_TestCase $paymentMethod->expects($this->once())->method('canUseForCountry')->with( self::EXPECTED_COUNTRY_ID )->will($this->returnValue($expectation)); + $this->countryProvider->expects($this->once())->method('getCountry')->willReturn(self::EXPECTED_COUNTRY_ID); $this->assertEquals($expectation, $this->_model->isApplicable($paymentMethod, $quoteMock)); } diff --git a/app/code/Magento/Payment/composer.json b/app/code/Magento/Payment/composer.json index 4f7a7f707bb8238f6619148cbeb112e5c90fb37f..b72ba192b4d49878924b8ce91a221228f2f2d199 100644 --- a/app/code/Magento/Payment/composer.json +++ b/app/code/Magento/Payment/composer.json @@ -8,6 +8,7 @@ "magento/module-sales": "0.74.0-beta16", "magento/module-checkout": "0.74.0-beta16", "magento/module-quote": "0.74.0-beta16", + "magento/module-directory": "0.74.0-beta16", "magento/framework": "0.74.0-beta16", "magento/magento-composer-installer": "*" }, diff --git a/app/code/Magento/SalesRule/view/frontend/layout/checkout_index_index.xml b/app/code/Magento/SalesRule/view/frontend/layout/checkout_index_index.xml index b9ba81bfaa8ec98f6f906d86cc704b184ee417ff..b5ddc47cf8baed97859a4fa27beceafceb83df59 100644 --- a/app/code/Magento/SalesRule/view/frontend/layout/checkout_index_index.xml +++ b/app/code/Magento/SalesRule/view/frontend/layout/checkout_index_index.xml @@ -33,14 +33,18 @@ </item> </item> </item> - <item name="summary" xsi:type="array"> + <item name="sidebar" xsi:type="array"> <item name="children" xsi:type="array"> - <item name="totals" xsi:type="array"> + <item name="summary" xsi:type="array"> <item name="children" xsi:type="array"> - <item name="discount" xsi:type="array"> - <item name="component" xsi:type="string">Magento_SalesRule/js/view/summary/discount</item> - <item name="config" xsi:type="array"> - <item name="title" xsi:type="string">Discount</item> + <item name="totals" xsi:type="array"> + <item name="children" xsi:type="array"> + <item name="discount" xsi:type="array"> + <item name="component" xsi:type="string">Magento_SalesRule/js/view/summary/discount</item> + <item name="config" xsi:type="array"> + <item name="title" xsi:type="string">Discount</item> + </item> + </item> </item> </item> </item> diff --git a/app/code/Magento/Tax/view/frontend/layout/checkout_index_index.xml b/app/code/Magento/Tax/view/frontend/layout/checkout_index_index.xml index db20c4572b1d90cde9ed306a8e68a06ae42a6ada..62de4a52b69254de101b989cda35db372172aefe 100644 --- a/app/code/Magento/Tax/view/frontend/layout/checkout_index_index.xml +++ b/app/code/Magento/Tax/view/frontend/layout/checkout_index_index.xml @@ -29,57 +29,61 @@ </item> </item> </item> - <item name="summary" xsi:type="array"> + <item name="sidebar" xsi:type="array"> <item name="children" xsi:type="array"> - <item name="totals" xsi:type="array"> + <item name="summary" xsi:type="array"> <item name="children" xsi:type="array"> - <!-- sort order for this totals is configured on admin panel--> - <!-- Stores->Configuration->SALES->Sales->General->Checkout Totals Sort Order --> - <item name="subtotal" xsi:type="array"> - <item name="component" xsi:type="string">Magento_Tax/js/view/checkout/summary/subtotal</item> - <item name="config" xsi:type="array"> - <item name="excludingTaxMessage" xsi:type="string">Excl. Tax</item> - <item name="includingTaxMessage" xsi:type="string">Incl. Tax</item> - </item> - </item> - <item name="shipping" xsi:type="array"> - <item name="component" xsi:type="string">Magento_Tax/js/view/checkout/summary/shipping</item> - <item name="sortOrder" xsi:type="string">20</item> - <item name="config" xsi:type="array"> - <item name="excludingTaxMessage" xsi:type="string">Excl. Tax</item> - <item name="includingTaxMessage" xsi:type="string">Incl. Tax</item> - </item> - </item> - <item name="before_grandtotal" xsi:type="array"> - <item name="component" xsi:type="string">uiComponent</item> - <item name="sortOrder" xsi:type="string">30</item> + <item name="totals" xsi:type="array"> <item name="children" xsi:type="array"> - <!-- merge your components here --> - </item> - </item> - <item name="tax" xsi:type="array"> - <item name="component" xsi:type="string">Magento_Tax/js/view/checkout/summary/tax</item> - <item name="config" xsi:type="array"> - <item name="title" xsi:type="string">Tax</item> - </item> - </item> - <item name="grand-total" xsi:type="array"> - <item name="component" xsi:type="string">Magento_Tax/js/view/checkout/summary/grand-total</item> - <item name="config" xsi:type="array"> - <item name="exclTaxLabel" xsi:type="string">Order Total Excl. Tax</item> - <item name="inclTaxLabel" xsi:type="string">Order Total Incl. Tax</item> - <item name="basicCurrencyMessage" xsi:type="string">Your credit card will be charged for</item> - <item name="title" xsi:type="string">Order Total</item> + <!-- sort order for this totals is configured on admin panel--> + <!-- Stores->Configuration->SALES->Sales->General->Checkout Totals Sort Order --> + <item name="subtotal" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Tax/js/view/checkout/summary/subtotal</item> + <item name="config" xsi:type="array"> + <item name="excludingTaxMessage" xsi:type="string">Excl. Tax</item> + <item name="includingTaxMessage" xsi:type="string">Incl. Tax</item> + </item> + </item> + <item name="shipping" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Tax/js/view/checkout/summary/shipping</item> + <item name="sortOrder" xsi:type="string">20</item> + <item name="config" xsi:type="array"> + <item name="excludingTaxMessage" xsi:type="string">Excl. Tax</item> + <item name="includingTaxMessage" xsi:type="string">Incl. Tax</item> + </item> + </item> + <item name="before_grandtotal" xsi:type="array"> + <item name="component" xsi:type="string">uiComponent</item> + <item name="sortOrder" xsi:type="string">30</item> + <item name="children" xsi:type="array"> + <!-- merge your components here --> + </item> + </item> + <item name="tax" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Tax/js/view/checkout/summary/tax</item> + <item name="config" xsi:type="array"> + <item name="title" xsi:type="string">Tax</item> + </item> + </item> + <item name="grand-total" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Tax/js/view/checkout/summary/grand-total</item> + <item name="config" xsi:type="array"> + <item name="exclTaxLabel" xsi:type="string">Order Total Excl. Tax</item> + <item name="inclTaxLabel" xsi:type="string">Order Total Incl. Tax</item> + <item name="basicCurrencyMessage" xsi:type="string">Your credit card will be charged for</item> + <item name="title" xsi:type="string">Order Total</item> + </item> + </item> </item> </item> - </item> - </item> - <item name="cart_items" xsi:type="array"> - <item name="children" xsi:type="array"> - <item name="details" xsi:type="array"> + <item name="cart_items" xsi:type="array"> <item name="children" xsi:type="array"> - <item name="subtotal" xsi:type="array"> - <item name="component" xsi:type="string">Magento_Tax/js/view/checkout/summary/item/details/subtotal</item> + <item name="details" xsi:type="array"> + <item name="children" xsi:type="array"> + <item name="subtotal" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Tax/js/view/checkout/summary/item/details/subtotal</item> + </item> + </item> </item> </item> </item> diff --git a/app/code/Magento/Weee/view/frontend/layout/checkout_index_index.xml b/app/code/Magento/Weee/view/frontend/layout/checkout_index_index.xml index 6e3439d0775862400bec88a4cf5885f4005358e5..78799c18cc5193b19c6ea61603d46859c7e4a1bf 100644 --- a/app/code/Magento/Weee/view/frontend/layout/checkout_index_index.xml +++ b/app/code/Magento/Weee/view/frontend/layout/checkout_index_index.xml @@ -14,31 +14,35 @@ <item name="components" xsi:type="array"> <item name="checkout" xsi:type="array"> <item name="children" xsi:type="array"> - <item name="summary" xsi:type="array"> + <item name="sidebar" xsi:type="array"> <item name="children" xsi:type="array"> - <item name="totals" xsi:type="array"> + <item name="summary" xsi:type="array"> <item name="children" xsi:type="array"> - <item name="weee" xsi:type="array"> - <item name="component" xsi:type="string">Magento_Weee/js/view/checkout/summary/weee</item> - <item name="config" xsi:type="array"> - <item name="title" xsi:type="string">FPT</item> + <item name="totals" xsi:type="array"> + <item name="children" xsi:type="array"> + <item name="weee" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Weee/js/view/checkout/summary/weee</item> + <item name="config" xsi:type="array"> + <item name="title" xsi:type="string">FPT</item> + </item> + </item> </item> </item> - </item> - </item> - <item name="cart_items" xsi:type="array"> - <item name="children" xsi:type="array"> - <item name="details" xsi:type="array"> + <item name="cart_items" xsi:type="array"> <item name="children" xsi:type="array"> - <item name="subtotal" xsi:type="array"> + <item name="details" xsi:type="array"> <item name="children" xsi:type="array"> - <item name="weee_row_incl_tax" xsi:type="array"> - <item name="component" xsi:type="string">Magento_Weee/js/view/checkout/summary/item/price/row_incl_tax</item> - <item name="displayArea" xsi:type="string">row_incl_tax</item> - </item> - <item name="weee_row_excl_tax" xsi:type="array"> - <item name="component" xsi:type="string">Magento_Weee/js/view/checkout/summary/item/price/row_excl_tax</item> - <item name="displayArea" xsi:type="string">row_excl_tax</item> + <item name="subtotal" xsi:type="array"> + <item name="children" xsi:type="array"> + <item name="weee_row_incl_tax" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Weee/js/view/checkout/summary/item/price/row_incl_tax</item> + <item name="displayArea" xsi:type="string">row_incl_tax</item> + </item> + <item name="weee_row_excl_tax" xsi:type="array"> + <item name="component" xsi:type="string">Magento_Weee/js/view/checkout/summary/item/price/row_excl_tax</item> + <item name="displayArea" xsi:type="string">row_excl_tax</item> + </item> + </item> </item> </item> </item> diff --git a/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_estimated-total.less b/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_estimated-total.less index 5119231620d6ee172e9906402baedc181b3f77fd..49b1685d5340ba166bfd0d26efe5a7a411c1a621 100644 --- a/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_estimated-total.less +++ b/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_estimated-total.less @@ -47,7 +47,7 @@ // Desktop // _____________________________________________ -.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__s) { +.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) { .opc-estimated-wrapper { display: none; } diff --git a/app/design/frontend/Magento/blank/web/css/source/components/_modals_extend.less b/app/design/frontend/Magento/blank/web/css/source/components/_modals_extend.less index e4b01ecd0df6e5d9a9c0c10e275d6ccc5098efa1..2d63705c1a1353a9e951e95a258fdf2af899e313 100644 --- a/app/design/frontend/Magento/blank/web/css/source/components/_modals_extend.less +++ b/app/design/frontend/Magento/blank/web/css/source/components/_modals_extend.less @@ -97,28 +97,7 @@ // Mobile // _____________________________________________ -.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @modal-popup-breakpoint-screen__m) { - .modal-popup { - &.modal-slide { - .modal-inner-wrap[class] { - .css(background-color, @modal-slide-mobile__background-color); - } - &._inner-scroll { - &._show { - -webkit-overflow-scrolling: touch; - overflow-y: auto; - } - .modal-inner-wrap { - height: auto; - min-height: 100%; - } - } - } - .modal-title { - .css(font-size, @modal-popup-title-mobile__font-size); - .css(font-weight, @font-weight__bold); - } - } +.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) { .custom-slide { .abs-modal(); .abs-modal-slide(); @@ -150,6 +129,30 @@ } } +.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @modal-popup-breakpoint-screen__m) { + .modal-popup { + &.modal-slide { + .modal-inner-wrap[class] { + .css(background-color, @modal-slide-mobile__background-color); + } + &._inner-scroll { + &._show { + -webkit-overflow-scrolling: touch; + overflow-y: auto; + } + .modal-inner-wrap { + height: auto; + min-height: 100%; + } + } + } + .modal-title { + .css(font-size, @modal-popup-title-mobile__font-size); + .css(font-weight, @font-weight__bold); + } + } +} + // // Desktop // _____________________________________________ diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_estimated-total.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_estimated-total.less index ccef519f1cbb1cbb51a1937d9a1ee524e74d621b..7a189d7e3254a6d572e1c35826fec5c9c4089430 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_estimated-total.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_estimated-total.less @@ -51,7 +51,7 @@ // Desktop // _____________________________________________ -.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__s) { +.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) { .opc-estimated-wrapper { display: none; } diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_progress-bar.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_progress-bar.less index 13b59d044d72bef7d86ee8c84ee5979a3745407c..4e5d1e9eb28646cd0ee842bfa15568e3bbb2b70d 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_progress-bar.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_progress-bar.less @@ -44,8 +44,8 @@ // --------------------------------------------- .opc-progress-bar { - &:extend(.abs-no-display-s all); &:extend(.abs-reset-list all); + display: none; } } @@ -53,11 +53,12 @@ // Desktop // _____________________________________________ -.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__s) { +.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) { .opc-progress-bar { .css(margin, 0 0 @checkout-progress-bar__margin); counter-reset: i; + display: block; font-size: 0; } diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Controller/OnepageTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Controller/OnepageTest.php deleted file mode 100644 index 567ad6ec03b1444b0393669a88aa8c43c328f108..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Checkout/Controller/OnepageTest.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php -/** - * Copyright © 2015 Magento. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Checkout\Controller; - -/** - * @magentoDataFixture Magento/Sales/_files/quote.php - */ -class OnepageTest extends \Magento\TestFramework\TestCase\AbstractController -{ - protected function setUp() - { - parent::setUp(); - $quote = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Quote\Model\Quote'); - $quote->load('test01', 'reserved_order_id'); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Checkout\Model\Session' - )->setQuoteId( - $quote->getId() - ); - } - - public function testSaveOrderActionWithoutFormKey() - { - $this->dispatch('checkout/onepage/saveOrder'); - $this->assertRedirect($this->stringContains('checkout/onepage')); - } - - public function testSaveOrderActionWithFormKey() - { - $formKey = $this->_objectManager->get('Magento\Framework\Data\Form\FormKey'); - $this->getRequest()->setParam('form_key', $formKey->getFormKey()); - $this->dispatch('checkout/onepage/saveOrder'); - $html = $this->getResponse()->getBody(); - $this->assertEquals( - '{"success":false,"error":true,"error_messages":"Please specify a shipping method."}', - $html, - $html - ); - } -}