diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php index d88dd58362896..31e178f0bd9b4 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php @@ -10,6 +10,8 @@ /** * Catalog product option select type + * + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) */ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType { @@ -30,23 +32,35 @@ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType */ protected $string; + /** + * @var array + */ + private $singleSelectionTypes; + /** * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\Escaper $escaper * @param array $data + * @param array $singleSelectionTypes */ public function __construct( \Magento\Checkout\Model\Session $checkoutSession, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\Stdlib\StringUtils $string, \Magento\Framework\Escaper $escaper, - array $data = [] + array $data = [], + array $singleSelectionTypes = [] ) { $this->string = $string; $this->_escaper = $escaper; parent::__construct($checkoutSession, $scopeConfig, $data); + + $this->singleSelectionTypes = $singleSelectionTypes ?: [ + 'drop_down' => \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN, + 'radio' => \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO, + ]; } /** @@ -310,10 +324,6 @@ public function getOptionSku($optionValue, $skuDelimiter) */ protected function _isSingleSelection() { - $single = [ - \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN, - \Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO, - ]; - return in_array($this->getOption()->getType(), $single); + return in_array($this->getOption()->getType(), $this->singleSelectionTypes, true); } } diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml index 49447447622f9..e30577a397668 100644 --- a/app/code/Magento/Catalog/etc/di.xml +++ b/app/code/Magento/Catalog/etc/di.xml @@ -1165,4 +1165,12 @@ + + + + Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_DROP_DOWN + Magento\Catalog\Api\Data\ProductCustomOptionInterface::OPTION_TYPE_RADIO + + + diff --git a/app/code/Magento/Config/Console/Command/ConfigSetCommand.php b/app/code/Magento/Config/Console/Command/ConfigSetCommand.php index cb79daddbf5f9..999d8e41af5bc 100644 --- a/app/code/Magento/Config/Console/Command/ConfigSetCommand.php +++ b/app/code/Magento/Config/Console/Command/ConfigSetCommand.php @@ -114,13 +114,13 @@ protected function configure() ), new InputOption( static::OPTION_LOCK_ENV, - 'le', + 'e', InputOption::VALUE_NONE, 'Lock value which prevents modification in the Admin (will be saved in app/etc/env.php)' ), new InputOption( static::OPTION_LOCK_CONFIG, - 'lc', + 'c', InputOption::VALUE_NONE, 'Lock and share value with other installations, prevents modification in the Admin ' . '(will be saved in app/etc/config.php)' @@ -139,8 +139,10 @@ protected function configure() /** * Creates and run appropriate processor, depending on input options. * - * {@inheritdoc} + * @param InputInterface $input + * @param OutputInterface $output * @since 100.2.0 + * @return int|null */ protected function execute(InputInterface $input, OutputInterface $output) { diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders.php index 2fb59ec767e8a..3d4ccb789dc72 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders.php @@ -107,7 +107,7 @@ protected function _prepareCollection() */ protected function _prepareColumns() { - $this->addColumn('increment_id', ['header' => __('Order'), 'width' => '100', 'index' => 'increment_id']); + $this->addColumn('increment_id', ['header' => __('Order #'), 'width' => '100', 'index' => 'increment_id']); $this->addColumn( 'created_at', @@ -140,7 +140,7 @@ protected function _prepareColumns() $this->addColumn( 'action', [ - 'header' => ' ', + 'header' => 'Action', 'filter' => false, 'sortable' => false, 'width' => '100px', diff --git a/app/code/Magento/Customer/i18n/en_US.csv b/app/code/Magento/Customer/i18n/en_US.csv index 578267984f985..e1c68f3d81e9d 100644 --- a/app/code/Magento/Customer/i18n/en_US.csv +++ b/app/code/Magento/Customer/i18n/en_US.csv @@ -47,7 +47,7 @@ Sending,Sending Paused,Paused View,View Unknown,Unknown -Order,Order +"Order #","Order #" Purchased,Purchased "Bill-to Name","Bill-to Name" "Ship-to Name","Ship-to Name" diff --git a/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator.js b/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator.js index 785b636d5832f..b459b3598a857 100644 --- a/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator.js +++ b/app/code/Magento/Payment/view/base/web/js/model/credit-card-validation/credit-card-number-validator.js @@ -36,7 +36,7 @@ define([ return resultWrapper(null, false, false); } - value = value.replace(/|\s/g, ''); + value = value.replace(/\s+/g, ''); if (!/^\d*$/.test(value)) { return resultWrapper(null, false, false); diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/abstract.js b/app/code/Magento/Ui/view/base/web/js/form/element/abstract.js index ca3d383accca1..c7fab7da4567e 100755 --- a/app/code/Magento/Ui/view/base/web/js/form/element/abstract.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/abstract.js @@ -296,7 +296,7 @@ define([ this.validation[rule] = options; } - changed = utils.compare(rules, this.validation).equal; + changed = !utils.compare(rules, this.validation).equal; if (changed) { this.required(!!rules['required-entry']); diff --git a/app/code/Magento/Vault/Observer/AfterPaymentSaveObserver.php b/app/code/Magento/Vault/Observer/AfterPaymentSaveObserver.php index 49d34091b136a..14b7cc6c726bb 100644 --- a/app/code/Magento/Vault/Observer/AfterPaymentSaveObserver.php +++ b/app/code/Magento/Vault/Observer/AfterPaymentSaveObserver.php @@ -77,11 +77,9 @@ public function execute(Observer $observer) $paymentToken->setPaymentMethodCode($payment->getMethod()); $additionalInformation = $payment->getAdditionalInformation(); - if (isset($additionalInformation[VaultConfigProvider::IS_ACTIVE_CODE])) { - $paymentToken->setIsVisible( - (bool) (int) $additionalInformation[VaultConfigProvider::IS_ACTIVE_CODE] - ); - } + $paymentToken->setIsVisible( + (bool) (int) ($additionalInformation[VaultConfigProvider::IS_ACTIVE_CODE] ?? 0) + ); $paymentToken->setPublicHash($this->generatePublicHash($paymentToken)); @@ -115,7 +113,7 @@ protected function generatePublicHash(PaymentTokenInterface $paymentToken) /** * Reads Payment token from Order Payment * - * @param OrderPaymentExtensionInterface | null $extensionAttributes + * @param OrderPaymentExtensionInterface|null $extensionAttributes * @return PaymentTokenInterface | null */ protected function getPaymentToken(OrderPaymentExtensionInterface $extensionAttributes = null) diff --git a/app/code/Magento/Vault/Test/Unit/Observer/AfterPaymentSaveObserverTest.php b/app/code/Magento/Vault/Test/Unit/Observer/AfterPaymentSaveObserverTest.php index 09c17d1e58d98..2ae16e186030d 100644 --- a/app/code/Magento/Vault/Test/Unit/Observer/AfterPaymentSaveObserverTest.php +++ b/app/code/Magento/Vault/Test/Unit/Observer/AfterPaymentSaveObserverTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Vault\Test\Unit\Observer; use Magento\Framework\App\DeploymentConfig; @@ -15,9 +16,13 @@ use Magento\Sales\Model\Order\Payment; use Magento\Vault\Model\PaymentToken; use Magento\Vault\Model\PaymentTokenManagement; +use Magento\Vault\Model\Ui\VaultConfigProvider; use Magento\Vault\Observer\AfterPaymentSaveObserver; use PHPUnit_Framework_MockObject_MockObject as MockObject; +/** + * Tests for AfterPaymentSaveObserver. + */ class AfterPaymentSaveObserverTest extends \PHPUnit\Framework\TestCase { /** @@ -93,7 +98,7 @@ protected function setUp() // Sales Order Payment Model $this->salesOrderPaymentMock = $this->getMockBuilder(Payment::class) - ->setMethods(null) + ->setMethods(['getAdditionalInformation']) ->disableOriginalConstructor() ->getMock(); $this->salesOrderPaymentMock->setOrder($this->salesOrderMock); @@ -122,9 +127,10 @@ protected function setUp() * @param string $token * @param bool $isActive * @param string $method + * @param array $additionalInfo * @dataProvider positiveCaseDataProvider */ - public function testPositiveCase($customerId, $createdAt, $token, $isActive, $method) + public function testPositiveCase($customerId, $createdAt, $token, $isActive, $method, $additionalInfo) { $this->paymentTokenMock->setGatewayToken($token); $this->paymentTokenMock->setCustomerId($customerId); @@ -136,6 +142,8 @@ public function testPositiveCase($customerId, $createdAt, $token, $isActive, $me ->method('getVaultPaymentToken') ->willReturn($this->paymentTokenMock); + $this->salesOrderPaymentMock->method('getAdditionalInformation')->willReturn($additionalInfo); + if (!empty($token)) { $this->paymentTokenManagementMock->expects($this->once()) ->method('saveTokenWithPaymentLink') @@ -158,6 +166,10 @@ public function testPositiveCase($customerId, $createdAt, $token, $isActive, $me static::assertEquals($token, $paymentToken->getGatewayToken()); static::assertEquals($isActive, $paymentToken->getIsActive()); static::assertEquals($createdAt, $paymentToken->getCreatedAt()); + static::assertEquals( + $additionalInfo[VaultConfigProvider::IS_ACTIVE_CODE] ?? false, + $paymentToken->getIsVisible() + ); } /** @@ -171,14 +183,32 @@ public function positiveCaseDataProvider() '10\20\2015', 'asdfg', true, - 'paypal' + 'paypal', + [], + ], + [ + 1, + '10\20\2015', + 'asdfg', + true, + 'paypal', + [VaultConfigProvider::IS_ACTIVE_CODE => true], + ], + [ + 1, + '10\20\2015', + 'asdfg', + true, + 'paypal', + [VaultConfigProvider::IS_ACTIVE_CODE => false], ], [ null, null, null, false, - null + null, + [], ], ]; } diff --git a/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/_module.less index dfcc51e0a0a26..b841f2206e1d9 100644 --- a/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/_module.less @@ -80,7 +80,7 @@ .page-main { > .page-title-wrapper { .page-title { - word-break: break-all; + hyphens: auto; } } }