diff --git a/app/bootstrap.php b/app/bootstrap.php index 3d474cea45432a6e42f72d2cabc2a57953260fac..e77c6d432c816c379ab226b366928d52cad3e426 100644 --- a/app/bootstrap.php +++ b/app/bootstrap.php @@ -14,12 +14,12 @@ error_reporting(E_ALL); if (!defined('PHP_VERSION_ID') || !(PHP_VERSION_ID === 70002 || PHP_VERSION_ID === 70004 || PHP_VERSION_ID >= 70006)) { if (PHP_SAPI == 'cli') { echo 'Magento supports 7.0.2, 7.0.4, and 7.0.6 or later. ' . - 'Please read http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html'; + 'Please read http://devdocs.magento.com/guides/v2.2/install-gde/system-requirements.html'; } else { echo <<<HTML <div style="font:12px/1.35em arial, helvetica, sans-serif;"> <p>Magento supports PHP 7.0.2, 7.0.4, and 7.0.6 or later. Please read - <a target="_blank" href="http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html"> + <a target="_blank" href="http://devdocs.magento.com/guides/v2.2/install-gde/system-requirements.html"> Magento System Requirements</a>. </div> HTML; diff --git a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js index 73a7b10d5d30f976b19750ccbe1efeb9c90a821b..d078cacb96c2d2ebbad294796fbec86990c5c6be 100644 --- a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js +++ b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js @@ -79,6 +79,7 @@ define( */ onError: function (response) { braintree.showError($t('Payment ' + this.getTitle() + ' can\'t be initialized')); + this.isPlaceOrderActionAllowed(true); throw response.message; }, diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml index 6ff0e193a774f4b1878a289518a971e698ea3347..f812a27f87ad936c7199b56ed67535204c97d537 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml @@ -57,7 +57,7 @@ $stores = $block->getStoresSortedBySortOrder(); <input type="hidden" id="option-count-check" value="" /> </div> <script id="row-template" type="text/x-magento-template"> - <tr> + <tr <% if (data.rowClasses) { %>class="<%- data.rowClasses %>"<% } %>> <td class="col-draggable"> <?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()): ?> <div data-role="draggable-handle" class="draggable-handle" diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/options.js b/app/code/Magento/Catalog/view/adminhtml/web/js/options.js index 5239eb207efca66a7e3566fa26d62b03fbffac6f..787516a9abf29fa499d7131a11bac552343d160e 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/options.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/options.js @@ -24,6 +24,7 @@ define([ totalItems: 0, rendered: 0, template: mageTemplate('#row-template'), + newOptionClass: 'new-option', isReadOnly: config.isReadOnly, add: function (data, render) { var isNewOption = false, @@ -32,7 +33,8 @@ define([ if (typeof data.id == 'undefined') { data = { 'id': 'option_' + this.itemCount, - 'sort_order': this.itemCount + 1 + 'sort_order': this.itemCount + 1, + 'rowClasses': this.newOptionClass }; isNewOption = true; } @@ -84,6 +86,10 @@ define([ this.totalItems--; this.updateItemsCountField(); } + + if (element.hasClassName(this.newOptionClass)) { + element.remove(); + } }, updateItemsCountField: function () { $('option-count-check').value = this.totalItems > 0 ? '1' : ''; diff --git a/app/code/Magento/Catalog/view/base/web/template/product/link.html b/app/code/Magento/Catalog/view/base/web/template/product/link.html index 98255e1b8a9e2a88aaad78ff9081818f8cb34161..2c70300f7aec3151e8476050338f07054e62db05 100644 --- a/app/code/Magento/Catalog/view/base/web/template/product/link.html +++ b/app/code/Magento/Catalog/view/base/web/template/product/link.html @@ -4,6 +4,7 @@ * See COPYING.txt for license details. */ --> -<a class="product-item-link" +<a if="isAllowed()" + class="product-item-link" attr="href: $row().url" text="label"/> diff --git a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Attribute/OptionSelectBuilder.php b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Attribute/OptionSelectBuilder.php index 958d802682d525097a2bc80db8e9ff9093c4c58e..5d9eed0a188fca900c210e3049295811d95272ff 100644 --- a/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Attribute/OptionSelectBuilder.php +++ b/app/code/Magento/ConfigurableProduct/Model/ResourceModel/Attribute/OptionSelectBuilder.php @@ -91,6 +91,12 @@ class OptionSelectBuilder implements OptionSelectBuilderInterface ] ), [] + )->joinInner( + ['attribute_option' => $this->attributeResource->getTable('eav_attribute_option')], + 'attribute_option.option_id = entity_value.value', + [] + )->order( + 'attribute_option.sort_order ASC' )->where( 'super_attribute.product_id = ?', $productId diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ResourceModel/Attribute/OptionSelectBuilderTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ResourceModel/Attribute/OptionSelectBuilderTest.php index 235c16c9b556c58961931a98ffecf9333408de30..9802c97372bbbb4fcff3e6837ff05a116dd530fb 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ResourceModel/Attribute/OptionSelectBuilderTest.php +++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/ResourceModel/Attribute/OptionSelectBuilderTest.php @@ -66,7 +66,7 @@ class OptionSelectBuilderTest extends \PHPUnit\Framework\TestCase ->disableOriginalConstructor() ->getMockForAbstractClass(); $this->select = $this->getMockBuilder(Select::class) - ->setMethods(['from', 'joinInner', 'joinLeft', 'where', 'columns']) + ->setMethods(['from', 'joinInner', 'joinLeft', 'where', 'columns', 'order']) ->disableOriginalConstructor() ->getMock(); $this->connectionMock->expects($this->atLeastOnce()) @@ -112,10 +112,28 @@ class OptionSelectBuilderTest extends \PHPUnit\Framework\TestCase { $this->select->expects($this->exactly(1))->method('from')->willReturnSelf(); $this->select->expects($this->exactly(1))->method('columns')->willReturnSelf(); - $this->select->expects($this->exactly(5))->method('joinInner')->willReturnSelf(); + $this->select->expects($this->exactly(6))->method('joinInner')->willReturnSelf(); $this->select->expects($this->exactly(3))->method('joinLeft')->willReturnSelf(); + $this->select->expects($this->exactly(1))->method('order')->willReturnSelf(); $this->select->expects($this->exactly(2))->method('where')->willReturnSelf(); + $this->attributeResourceMock->expects($this->exactly(9)) + ->method('getTable') + ->will( + $this->returnValueMap( + [ + ['catalog_product_super_attribute', 'catalog_product_super_attribute value'], + ['catalog_product_entity', 'catalog_product_entity value'], + ['catalog_product_super_link', 'catalog_product_super_link value'], + ['eav_attribute', 'eav_attribute value'], + ['catalog_product_entity', 'catalog_product_entity value'], + ['catalog_product_super_attribute_label', 'catalog_product_super_attribute_label value'], + ['eav_attribute_option', 'eav_attribute_option value'], + ['eav_attribute_option_value', 'eav_attribute_option_value value'] + ] + ) + ); + $this->abstractAttributeMock->expects($this->atLeastOnce()) ->method('getAttributeId') ->willReturn('getAttributeId value'); @@ -138,10 +156,27 @@ class OptionSelectBuilderTest extends \PHPUnit\Framework\TestCase { $this->select->expects($this->exactly(1))->method('from')->willReturnSelf(); $this->select->expects($this->exactly(0))->method('columns')->willReturnSelf(); - $this->select->expects($this->exactly(5))->method('joinInner')->willReturnSelf(); + $this->select->expects($this->exactly(6))->method('joinInner')->willReturnSelf(); $this->select->expects($this->exactly(1))->method('joinLeft')->willReturnSelf(); + $this->select->expects($this->exactly(1))->method('order')->willReturnSelf(); $this->select->expects($this->exactly(2))->method('where')->willReturnSelf(); + $this->attributeResourceMock->expects($this->exactly(7)) + ->method('getTable') + ->will( + $this->returnValueMap( + [ + ['catalog_product_super_attribute', 'catalog_product_super_attribute value'], + ['catalog_product_entity', 'catalog_product_entity value'], + ['catalog_product_super_link', 'catalog_product_super_link value'], + ['eav_attribute', 'eav_attribute value'], + ['catalog_product_entity', 'catalog_product_entity value'], + ['catalog_product_super_attribute_label', 'catalog_product_super_attribute_label value'], + ['eav_attribute_option', 'eav_attribute_option value'] + ] + ) + ); + $this->abstractAttributeMock->expects($this->atLeastOnce()) ->method('getAttributeId') ->willReturn('getAttributeId value'); diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js index 24fc24363562b94fcae0cb8684edcf2e6a09f353..be290e49a43c372bf8a2dc2a4d0a53127f9cd2f6 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js @@ -357,12 +357,12 @@ define([ var element; _.each(this.disabledAttributes, function (attribute) { - registry.get('index = ' + attribute).disabled(false); + registry.get('code = ' + attribute, 'index = ' + attribute).disabled(false); }); this.disabledAttributes = []; _.each(attributes, function (attribute) { - element = registry.get('index = ' + attribute.code); + element = registry.get('code = ' + attribute.code, 'index = ' + attribute.code); if (!_.isUndefined(element)) { element.disabled(true); diff --git a/app/code/Magento/Deploy/Console/Command/SetModeCommand.php b/app/code/Magento/Deploy/Console/Command/SetModeCommand.php index c4485656fb88465cee36229105fcf87ffd349d79..55b4a4f4f9b6a70edd682046cb051b7db3732061 100644 --- a/app/code/Magento/Deploy/Console/Command/SetModeCommand.php +++ b/app/code/Magento/Deploy/Console/Command/SetModeCommand.php @@ -101,6 +101,9 @@ class SetModeCommand extends Command $modeController->enableProductionMode(); } break; + case State::MODE_DEFAULT: + $modeController->enableDefaultMode(); + break; default: throw new LocalizedException(__('Cannot switch into given mode "%1"', $toMode)); } diff --git a/app/code/Magento/Deploy/Model/Mode.php b/app/code/Magento/Deploy/Model/Mode.php index 3810ef0953124521932c95e78e0e482fff832b00..792ee7f1b79685cc6717ac749850a07e1070447a 100644 --- a/app/code/Magento/Deploy/Model/Mode.php +++ b/app/code/Magento/Deploy/Model/Mode.php @@ -177,6 +177,25 @@ class Mode $this->setStoreMode(State::MODE_DEVELOPER); } + /** + * Enable Default mode + * + * @return void + */ + public function enableDefaultMode() + { + $this->filesystem->cleanupFilesystem( + [ + DirectoryList::CACHE, + DirectoryList::GENERATED_CODE, + DirectoryList::GENERATED_METADATA, + DirectoryList::TMP_MATERIALIZATION_DIR, + DirectoryList::STATIC_VIEW, + ] + ); + $this->setStoreMode(State::MODE_DEFAULT); + } + /** * Get current mode information * diff --git a/app/code/Magento/Deploy/Test/Unit/Console/Command/SetModeCommandTest.php b/app/code/Magento/Deploy/Test/Unit/Console/Command/SetModeCommandTest.php index caa310535f3569bbe31836d3067906e93ec905e6..a49bae655e87f42899976cf2118d46a1c426a43b 100644 --- a/app/code/Magento/Deploy/Test/Unit/Console/Command/SetModeCommandTest.php +++ b/app/code/Magento/Deploy/Test/Unit/Console/Command/SetModeCommandTest.php @@ -67,6 +67,18 @@ class SetModeCommandTest extends \PHPUnit\Framework\TestCase ); } + public function testSetDefaultMode() + { + $this->modeMock->expects($this->once())->method('enableDefaultMode'); + + $tester = new CommandTester($this->command); + $tester->execute(['mode' => 'default']); + $this->assertContains( + "default mode", + $tester->getDisplay() + ); + } + public function testSetProductionSkipCompilation() { $this->modeMock->expects($this->once())->method('enableProductionModeMinimal'); diff --git a/app/code/Magento/Paypal/Model/Express.php b/app/code/Magento/Paypal/Model/Express.php index 8ba8adcede511745f53fa94bbc4632920e37f529..accb22b265335de00797e66a36252537eb902628 100644 --- a/app/code/Magento/Paypal/Model/Express.php +++ b/app/code/Magento/Paypal/Model/Express.php @@ -669,7 +669,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod public function assignData(\Magento\Framework\DataObject $data) { parent::assignData($data); - + $additionalData = $data->getData(PaymentInterface::KEY_ADDITIONAL_DATA); if (!is_array($additionalData)) { @@ -677,6 +677,11 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod } foreach ($additionalData as $key => $value) { + // Skip extension attributes + if ($key === \Magento\Framework\Api\ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY) { + continue; + } + $this->getInfoInstance()->setAdditionalInformation($key, $value); } return $this; diff --git a/app/code/Magento/Paypal/Test/Unit/Model/ExpressTest.php b/app/code/Magento/Paypal/Test/Unit/Model/ExpressTest.php index 6a2d33d010190fd0d659d28a447753c3761e94b3..1b8c33622e784154908d6df12b3f6592f33ca68a 100644 --- a/app/code/Magento/Paypal/Test/Unit/Model/ExpressTest.php +++ b/app/code/Magento/Paypal/Test/Unit/Model/ExpressTest.php @@ -161,12 +161,21 @@ class ExpressTest extends \PHPUnit\Framework\TestCase { $transportValue = 'something'; + $extensionAttribute = $this->getMockForAbstractClass( + \Magento\Quote\Api\Data\PaymentExtensionInterface::class, + [], + '', + false, + false + ); + $data = new DataObject( [ PaymentInterface::KEY_ADDITIONAL_DATA => [ Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT => $transportValue, Express\Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID => $transportValue, - Express\Checkout::PAYMENT_INFO_TRANSPORT_TOKEN => $transportValue + Express\Checkout::PAYMENT_INFO_TRANSPORT_TOKEN => $transportValue, + \Magento\Framework\Api\ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY => $extensionAttribute ] ] ); diff --git a/app/code/Magento/Paypal/view/frontend/web/js/action/set-payment-method.js b/app/code/Magento/Paypal/view/frontend/web/js/action/set-payment-method.js index a994f9defd583823f6da37557f675f94eee13cbd..63e34437c6f90c6b663b3eaf0bd1da306ffec3d3 100644 --- a/app/code/Magento/Paypal/view/frontend/web/js/action/set-payment-method.js +++ b/app/code/Magento/Paypal/view/frontend/web/js/action/set-payment-method.js @@ -4,48 +4,12 @@ */ define([ - 'jquery', 'Magento_Checkout/js/model/quote', - 'Magento_Checkout/js/model/url-builder', - 'mage/storage', - 'Magento_Checkout/js/model/error-processor', - 'Magento_Customer/js/model/customer', - 'Magento_Checkout/js/model/full-screen-loader' -], function ($, quote, urlBuilder, storage, errorProcessor, customer, fullScreenLoader) { + 'Magento_Checkout/js/action/set-payment-information' +], function (quote, setPaymentInformation) { 'use strict'; return function (messageContainer) { - var serviceUrl, - payload, - paymentData = quote.paymentMethod(); - - /** - * Checkout for guest and registered customer. - */ - if (!customer.isLoggedIn()) { - serviceUrl = urlBuilder.createUrl('/guest-carts/:cartId/set-payment-information', { - cartId: quote.getQuoteId() - }); - payload = { - cartId: quote.getQuoteId(), - email: quote.guestEmail, - paymentMethod: paymentData - }; - } else { - serviceUrl = urlBuilder.createUrl('/carts/mine/set-payment-information', {}); - payload = { - cartId: quote.getQuoteId(), - paymentMethod: paymentData - }; - } - fullScreenLoader.startLoader(); - - return storage.post( - serviceUrl, JSON.stringify(payload) - ).fail(function (response) { - errorProcessor.process(response, messageContainer); - }).always(function () { - fullScreenLoader.stopLoader(); - }); + return setPaymentInformation(messageContainer, quote.paymentMethod()); }; }); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php index 63c266150384ae4703724df39ec20e64054a8e6b..c45a1982784e17696b595f0d15102f068fc01a00 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Save.php @@ -191,14 +191,7 @@ class Save extends \Magento\Backend\App\Action } $transactionSave->save(); - if (isset($shippingResponse) && $shippingResponse->hasErrors()) { - $this->messageManager->addError( - __( - 'The invoice and the shipment have been created. ' . - 'The shipping label cannot be created now.' - ) - ); - } elseif (!empty($data['do_shipment'])) { + if (!empty($data['do_shipment'])) { $this->messageManager->addSuccess(__('You created the invoice and shipment.')); } else { $this->messageManager->addSuccess(__('The invoice has been created.')); diff --git a/app/code/Magento/Sales/i18n/en_US.csv b/app/code/Magento/Sales/i18n/en_US.csv index 65682843002255d8b6a1078280896fba632dc644..a32f3cacce7564a8cc3bf40db65e84136757951a 100644 --- a/app/code/Magento/Sales/i18n/en_US.csv +++ b/app/code/Magento/Sales/i18n/en_US.csv @@ -233,7 +233,6 @@ Sales,Sales "You can't create an invoice without products.","You can't create an invoice without products." "New Invoice","New Invoice" "We can't save the invoice right now.","We can't save the invoice right now." -"The invoice and the shipment have been created. The shipping label cannot be created now.","The invoice and the shipment have been created. The shipping label cannot be created now." "You created the invoice and shipment.","You created the invoice and shipment." "The invoice has been created.","The invoice has been created." "We can't send the invoice email right now.","We can't send the invoice email right now." diff --git a/app/code/Magento/Translation/Model/Js/DataProvider.php b/app/code/Magento/Translation/Model/Js/DataProvider.php index 6212647110941b3786d16f974dcc8f567bc4d37f..9037574e28a5b4731e244023d1d8efcedfad5042 100644 --- a/app/code/Magento/Translation/Model/Js/DataProvider.php +++ b/app/code/Magento/Translation/Model/Js/DataProvider.php @@ -46,7 +46,7 @@ class DataProvider implements DataProviderInterface /** * Basic translate renderer * - * @var \Magento\Framework\Phrase\Renderer\Translate + * @var \Magento\Framework\Phrase\RendererInterface */ protected $translate; @@ -54,7 +54,7 @@ class DataProvider implements DataProviderInterface * @param \Magento\Framework\App\State $appState * @param Config $config * @param \Magento\Framework\Filesystem\File\ReadFactory $fileReadFactory - * @param \Magento\Framework\Phrase\Renderer\Translate $translate + * @param \Magento\Framework\Phrase\RendererInterface $translate * @param \Magento\Framework\Component\ComponentRegistrar $componentRegistrar * @param \Magento\Framework\Component\DirSearch $dirSearch * @param \Magento\Framework\View\Design\Theme\ThemePackageList $themePackageList @@ -64,7 +64,7 @@ class DataProvider implements DataProviderInterface \Magento\Framework\App\State $appState, Config $config, \Magento\Framework\Filesystem\File\ReadFactory $fileReadFactory, - \Magento\Framework\Phrase\Renderer\Translate $translate, + \Magento\Framework\Phrase\RendererInterface $translate, \Magento\Framework\Component\ComponentRegistrar $componentRegistrar, \Magento\Framework\Component\DirSearch $dirSearch, \Magento\Framework\View\Design\Theme\ThemePackageList $themePackageList, diff --git a/app/code/Magento/Ui/Controller/Adminhtml/Index/Render.php b/app/code/Magento/Ui/Controller/Adminhtml/Index/Render.php index d2ce1a58725a8928d28b6d91589de1f6469efc8b..6eb503a64cc3d8c3d22b8450c8453c686f953133 100644 --- a/app/code/Magento/Ui/Controller/Adminhtml/Index/Render.php +++ b/app/code/Magento/Ui/Controller/Adminhtml/Index/Render.php @@ -88,7 +88,7 @@ class Render extends AbstractAction } catch (\Exception $e) { $this->logger->critical($e); $result = [ - 'error' => _('UI component could not be rendered because of system exception'), + 'error' => __('UI component could not be rendered because of system exception'), 'errorcode' => $this->escaper->escapeHtml($e->getCode()) ]; /** @var \Magento\Framework\Controller\Result\Json $resultJson */ diff --git a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/actions-bar/_store-switcher.less b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/actions-bar/_store-switcher.less index 2ae0f3d2430bb87b4c47891dae8f0fdff569dbac..80bebb22a90434cfebd9ad46b0545536f03f8a1e 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/actions-bar/_store-switcher.less +++ b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/actions-bar/_store-switcher.less @@ -42,6 +42,14 @@ max-height: 250px; overflow-y: auto; padding-top: .25em; + &::-webkit-scrollbar { + -webkit-appearance: none; + width: 7px; + } + &::-webkit-scrollbar-thumb { + border-radius: 4px; + background-color: rgba(0, 0, 0, .5); + } li { border: 0; diff --git a/composer.json b/composer.json index affd28d1fe133bdc01e8ceb0fdaecbb42440349b..fbc378d01a5cda35f60c60f6aa1db06db7533c48 100644 --- a/composer.json +++ b/composer.json @@ -59,6 +59,7 @@ "ext-dom": "*", "ext-simplexml": "*", "ext-mcrypt": "*", + "ext-bcmath": "*", "ext-hash": "*", "ext-curl": "*", "ext-iconv": "*", diff --git a/composer.lock b/composer.lock index 0f16d512409c033227ab24d0550291a0d3258187..2f9c7d47e323b51f2120dd441b1dc7ff86ba4eef 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "a6f1ec648029ca7b40870c3356fa955c", + "content-hash": "009029e4e58a3802cc9ad92333fad729", "packages": [ { "name": "braintree/braintree_php", @@ -6498,6 +6498,7 @@ "ext-dom": "*", "ext-simplexml": "*", "ext-mcrypt": "*", + "ext-bcmath": "*", "ext-hash": "*", "ext-curl": "*", "ext-iconv": "*", diff --git a/dev/tests/integration/etc/di/preferences/ce.php b/dev/tests/integration/etc/di/preferences/ce.php index 0e6f90d75f31122f57d849c00361adc8a4fb2bff..d5aaa7e730826376a130054a65d18ffc084c91e1 100644 --- a/dev/tests/integration/etc/di/preferences/ce.php +++ b/dev/tests/integration/etc/di/preferences/ce.php @@ -16,6 +16,8 @@ return [ \Magento\Framework\App\Response\Http::class => \Magento\TestFramework\Response::class, \Magento\Framework\Interception\PluginListInterface::class => \Magento\TestFramework\Interception\PluginList::class, + \Magento\Framework\Interception\ObjectManager\ConfigInterface::class => + \Magento\TestFramework\ObjectManager\Config::class, \Magento\Framework\Interception\ObjectManager\Config\Developer::class => \Magento\TestFramework\ObjectManager\Config::class, \Magento\Framework\View\LayoutInterface::class => \Magento\TestFramework\View\Layout::class, diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Braintree/frontend/js/view/payment/method-renderer/cc-form.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Braintree/frontend/js/view/payment/method-renderer/cc-form.test.js index d71f517b5e7f9c1ccde4a6de66376bb5820faf1e..52739eec2782b071a08d7a680677939e8dd96979 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Braintree/frontend/js/view/payment/method-renderer/cc-form.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Braintree/frontend/js/view/payment/method-renderer/cc-form.test.js @@ -27,7 +27,7 @@ define([ ), 'Magento_Braintree/js/view/payment/adapter': jasmine.createSpyObj( 'adapter', - ['setup', 'setConfig'] + ['setup', 'setConfig', 'showError'] ) }, braintreeCcForm; @@ -43,14 +43,17 @@ define([ }; injector.mock(mocks); injector.require(['Magento_Braintree/js/view/payment/method-renderer/cc-form'], function (Constr) { - braintreeCcForm = new Constr({ - provider: 'provName', - name: 'test', - index: 'test' - }); - - done(); + braintreeCcForm = new Constr({ + provider: 'provName', + name: 'test', + index: 'test', + item: { + title: 'Braintree' + } }); + + done(); + }); }); it('Check if payment code and message container are restored after onActiveChange call.', function () { @@ -65,5 +68,21 @@ define([ expect(braintreeCcForm.getCode()).toEqual(expectedCode); expect(braintreeCcForm.messageContainer).toEqual(expectedMessageContainer); }); + + it('Check if form validation fails when "Place Order" button should be active.', function () { + var errorMessage = 'Something went wrong.', + + /** + * Anonymous wrapper + */ + func = function () { + braintreeCcForm.clientConfig.onError({ + 'message': errorMessage + }); + }; + + expect(func).toThrow(errorMessage); + expect(braintreeCcForm.isPlaceOrderActionAllowed()).toBeTruthy(); + }); }); }); diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/CheckoutAgreements/frontend/js/model/place-order-mixin.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/CheckoutAgreements/frontend/js/model/place-order-mixin.test.js new file mode 100644 index 0000000000000000000000000000000000000000..545daf0a330c9dc04f3a8f03bf8d7998852a299e --- /dev/null +++ b/dev/tests/js/jasmine/tests/app/code/Magento/CheckoutAgreements/frontend/js/model/place-order-mixin.test.js @@ -0,0 +1,55 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'squire' +], function (Squire) { + 'use strict'; + + var injector = new Squire(), + mocks = { + 'Magento_Checkout/js/action/place-order': jasmine.createSpy('placeOrderAction'), + 'Magento_CheckoutAgreements/js/model/agreements-assigner': jasmine.createSpy('agreementsAssigner') + }, + defaultContext = require.s.contexts._, + mixin, + placeOrderAction; + + beforeEach(function (done) { + window.checkoutConfig = { + checkoutAgreements: { + isEnabled: true + } + }; + injector.mock(mocks); + injector.require([ + 'Magento_CheckoutAgreements/js/model/place-order-mixin', + 'Magento_Checkout/js/action/place-order' + ], function (Mixin, placeOrder) { + mixin = Mixin; + placeOrderAction = placeOrder; + done(); + }); + }); + + describe('Magento_CheckoutAgreements/js/model/place-order-mixin', function () { + it('mixin is applied to Magento_Checkout/js/action/place-order', function () { + var placeOrderMixins = defaultContext.config.config.mixins['Magento_Checkout/js/action/place-order']; + + expect(placeOrderMixins['Magento_CheckoutAgreements/js/model/place-order-mixin']).toBe(true); + }); + + it('Magento_CheckoutAgreements/js/model/agreements-assigner is called', function () { + var messageContainer = jasmine.createSpy('messageContainer'), + paymentData = {}; + + mixin(placeOrderAction)(paymentData, messageContainer); + expect(mocks['Magento_CheckoutAgreements/js/model/agreements-assigner']) + .toHaveBeenCalledWith(paymentData); + expect(mocks['Magento_Checkout/js/action/place-order']) + .toHaveBeenCalledWith(paymentData, messageContainer); + }); + }); +}); diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/CheckoutAgreements/frontend/js/model/set-payment-information-mixin.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/CheckoutAgreements/frontend/js/model/set-payment-information-mixin.test.js new file mode 100644 index 0000000000000000000000000000000000000000..ed525bfd96a6c6ea57ffdbd56efd30a6ee920718 --- /dev/null +++ b/dev/tests/js/jasmine/tests/app/code/Magento/CheckoutAgreements/frontend/js/model/set-payment-information-mixin.test.js @@ -0,0 +1,56 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'squire' +], function (Squire) { + 'use strict'; + + var injector = new Squire(), + mocks = { + 'Magento_Checkout/js/action/set-payment-information': jasmine.createSpy('placeOrderAction'), + 'Magento_CheckoutAgreements/js/model/agreements-assigner': jasmine.createSpy('agreementsAssigner') + }, + defaultContext = require.s.contexts._, + mixin, + placeOrderAction; + + beforeEach(function (done) { + window.checkoutConfig = { + checkoutAgreements: { + isEnabled: true + } + }; + injector.mock(mocks); + injector.require([ + 'Magento_CheckoutAgreements/js/model/set-payment-information-mixin', + 'Magento_Checkout/js/action/set-payment-information' + ], function (Mixin, setPaymentInformation) { + mixin = Mixin; + placeOrderAction = setPaymentInformation; + done(); + }); + }); + + describe('Magento_CheckoutAgreements/js/model/set-payment-information-mixin', function () { + it('mixin is applied to Magento_Checkout/js/action/set-payment-information', function () { + var placeOrderMixins = defaultContext + .config.config.mixins['Magento_Checkout/js/action/set-payment-information']; + + expect(placeOrderMixins['Magento_CheckoutAgreements/js/model/set-payment-information-mixin']).toBe(true); + }); + + it('Magento_CheckoutAgreements/js/model/agreements-assigner is called', function () { + var messageContainer = jasmine.createSpy('messageContainer'), + paymentData = {}; + + mixin(placeOrderAction)(messageContainer, paymentData); + expect(mocks['Magento_CheckoutAgreements/js/model/agreements-assigner']) + .toHaveBeenCalledWith(paymentData); + expect(mocks['Magento_Checkout/js/action/set-payment-information']) + .toHaveBeenCalledWith(messageContainer, paymentData); + }); + }); +}); diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Paypal/frontend/js/view/payment/method-renderer/paypal-express-abstract.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Paypal/frontend/js/view/payment/method-renderer/paypal-express-abstract.test.js index dc520c52385687b72d67602bad2cf8fd060b29ab..47e3507ea13214957d8ec0c0f9453d6fe93aa1a6 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Paypal/frontend/js/view/payment/method-renderer/paypal-express-abstract.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Paypal/frontend/js/view/payment/method-renderer/paypal-express-abstract.test.js @@ -16,6 +16,13 @@ define([ describe('paypal/js/view/payment/method-renderer/paypal-express-abstract', function () { var injector = new Squire(), + successPromise = jasmine.createSpyObj('successPromise', ['done']), + setPaymentMock = jasmine.createSpy('set-payment-information', function () { + return successPromise; + }).and.callThrough(), + validateMock = jasmine.createSpy('validate', function () { + return true; + }).and.callThrough(), mocks = { 'Magento_Checkout/js/model/quote': { billingAddress: ko.observable(), @@ -23,6 +30,10 @@ define([ paymentMethod: ko.observable(), totals: ko.observable({}) + }, + 'Magento_Checkout/js/action/set-payment-information': setPaymentMock, + 'Magento_Checkout/js/model/payment/additional-validators': { + validate: validateMock } }, paypalExpressAbstract, @@ -85,6 +96,23 @@ define([ }, 500); }); + it('setPaymentMethodAction is called before redirect to paypal', function () { + spyOn(paypalExpressAbstract, 'selectPaymentMethod'); + paypalExpressAbstract.continueToPayPal(); + expect(paypalExpressAbstract.selectPaymentMethod).toHaveBeenCalled(); + expect(validateMock).toHaveBeenCalled(); + expect(validateMock.calls.mostRecent()).toEqual(jasmine.objectContaining({ + object: mocks['Magento_Checkout/js/model/payment/additional-validators'], + args: [], + returnValue: true + })); + expect(setPaymentMock).toHaveBeenCalled(); + expect(setPaymentMock.calls.mostRecent()).toEqual(jasmine.objectContaining({ + returnValue: successPromise + })); + expect(successPromise.done).toHaveBeenCalledWith(jasmine.any(Function)); + }); + afterAll(function (done) { tplElement.remove(); done(); diff --git a/lib/internal/Magento/Framework/Phrase/Test/Unit/Renderer/InlineTest.php b/lib/internal/Magento/Framework/Phrase/Test/Unit/Renderer/InlineTest.php index f9b6e47c19a8634943f3b76e1633fb82ed954c48..d5b9443788dd2ee6d131e13af6d0eb038bb594aa 100644 --- a/lib/internal/Magento/Framework/Phrase/Test/Unit/Renderer/InlineTest.php +++ b/lib/internal/Magento/Framework/Phrase/Test/Unit/Renderer/InlineTest.php @@ -13,7 +13,7 @@ class InlineTest extends \PHPUnit\Framework\TestCase protected $translator; /** - * @var \Magento\Framework\Phrase\Renderer\Translate + * @var \Magento\Framework\Phrase\Renderer\Inline */ protected $renderer; diff --git a/lib/internal/Magento/Framework/composer.json b/lib/internal/Magento/Framework/composer.json index 17669bd78bd698c3f035091f5d180a4ed03146d2..49265774814d964d4897ede372c636c8b04eb1ec 100644 --- a/lib/internal/Magento/Framework/composer.json +++ b/lib/internal/Magento/Framework/composer.json @@ -20,6 +20,7 @@ "ext-openssl": "*", "lib-libxml": "*", "ext-xsl": "*", + "ext-bcmath": "*", "symfony/process": "~2.1", "colinmollenhour/php-redis-session-abstract": "1.3.4", "composer/composer": "1.4.1", diff --git a/nginx.conf.sample b/nginx.conf.sample index 7257c329df24b295905c7caad55c8257e679add5..1e20a51a511d3b9c95f3af13dc0c6236a556a897 100644 --- a/nginx.conf.sample +++ b/nginx.conf.sample @@ -100,7 +100,7 @@ location /static/ { # Remove signature of the static files that is used to overcome the browser cache location ~ ^/static/version { - rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last; + rewrite ^/static/(version[^/]+/)?(.*)$ /static/$2 last; } location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ { diff --git a/setup/view/magento/setup/readiness-check/progress.phtml b/setup/view/magento/setup/readiness-check/progress.phtml index c1ac41c6b5f2eb0fdeaeb3398656305fe0538e99..eb9dd0ce9d1aa3575b32d4950c3e973dabce93c0 100755 --- a/setup/view/magento/setup/readiness-check/progress.phtml +++ b/setup/view/magento/setup/readiness-check/progress.phtml @@ -336,7 +336,7 @@ </div> <p ng-show="componentDependency.expanded">For additional assistance, see - <a href="http://devdocs.magento.com/guides/v2.0/install-gde/trouble/php/tshoot_php-set.html" + <a href="http://devdocs.magento.com/guides/v2.2/install-gde/trouble/php/tshoot_php-set.html" target="_blank">PHP settings check help </a>. </p> @@ -392,7 +392,7 @@ <div class="readiness-check-side"> <p class="side-title">Need Help?</p> - <a href="http://devdocs.magento.com/guides/v2.0/install-gde/system-requirements.html" target="_blank">PHP Extension Help</a> + <a href="http://devdocs.magento.com/guides/v2.2/install-gde/system-requirements.html" target="_blank">PHP Extension Help</a> </div> <span class="readiness-check-icon icon-failed-round"></span> @@ -413,7 +413,7 @@ <p> The best way to resolve this is to install the correct missing extensions. The exact fix depends on our server, your host, and other system variables. <br> - Our <a href="http://devdocs.magento.com/guides/v2.0/install-gde/system-requirements.html" target="_blank">PHP extension help</a> can get you started. + Our <a href="http://devdocs.magento.com/guides/v2.2/install-gde/system-requirements.html" target="_blank">PHP extension help</a> can get you started. </p> <p> For additional assistance, contact your hosting provider. @@ -477,7 +477,7 @@ <div class="readiness-check-side"> <p class="side-title">Need Help?</p> - <a href="http://devdocs.magento.com/guides/v2.0/install-gde/install/file-system-perms.html" target="_blank">File Permission Help</a> + <a href="http://devdocs.magento.com/guides/v2.2/install-gde/prereq/file-system-perms.html" target="_blank">File Permission Help</a> </div> <span class="readiness-check-icon icon-failed-round"></span> @@ -500,7 +500,7 @@ The best way to resolve this is to allow write permissions for files in the following Magento directories and subdirectories. The exact fix depends on your server, your host, and other system variables. <br> - For help, see our <a href="http://devdocs.magento.com/guides/v2.0/install-gde/install/file-system-perms.html" target="_blank">File Permission Help</a> or call your hosting provider. + For help, see our <a href="http://devdocs.magento.com/guides/v2.2/install-gde/prereq/file-system-perms.html" target="_blank">File Permission Help</a> or call your hosting provider. </p> <ul class="list" ng-show="permissions.expanded" ng-init="showDetails=false"> <li