diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 3ac68076d4353..f6c8b354f42cc 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,24 +1,35 @@ - - + ### Preconditions - - + 1. 2. ### Steps to reproduce - + 1. 2. 3. ### Expected result -1. +1. [Screenshot, logs] ### Actual result 1. [Screenshot, logs] - - diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index d1f01ba9f2640..5b0b9d74e453b 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,15 +1,32 @@ - + + + ### Description - + ### Fixed Issues (if relevant) - + 1. magento/magento2#: Issue title 2. ... ### Manual testing scenarios - + 1. ... 2. ... diff --git a/app/code/Magento/Braintree/etc/di.xml b/app/code/Magento/Braintree/etc/di.xml index 5f4a345760f2d..2bb4cea6742d6 100644 --- a/app/code/Magento/Braintree/etc/di.xml +++ b/app/code/Magento/Braintree/etc/di.xml @@ -447,7 +447,7 @@ - Magento\Vault\Model\AccountPaymentTokenFactory + Magento\Vault\Api\Data\PaymentTokenFactoryInterface diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php index 6a9abe0a4c64e..e054a9d49b437 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php @@ -139,9 +139,7 @@ public function execute() ->setName($name) ->getAttributeSet(); } catch (AlreadyExistsException $alreadyExists) { - $this->messageManager->addErrorMessage( - __('A "%1" attribute set name already exists. Create a new name and try again.', $name) - ); + $this->messageManager->addErrorMessage(__('An attribute set named \'%1\' already exists.', $name)); $this->_session->setAttributeData($data); return $this->returnResult('catalog/*/edit', ['_current' => true], ['error' => true]); } catch (LocalizedException $e) { @@ -202,6 +200,8 @@ public function execute() } } + $data = $this->presentation->convertPresentationDataToInputType($data); + if ($attributeId) { if (!$model->getId()) { $this->messageManager->addErrorMessage(__('This attribute no longer exists.')); @@ -216,7 +216,7 @@ public function execute() $data['attribute_code'] = $model->getAttributeCode(); $data['is_user_defined'] = $model->getIsUserDefined(); - $data['frontend_input'] = $model->getFrontendInput(); + $data['frontend_input'] = $data['frontend_input'] ?? $model->getFrontendInput(); } else { /** * @todo add to helper and specify all relations for properties @@ -229,8 +229,6 @@ public function execute() ); } - $data = $this->presentation->convertPresentationDataToInputType($data); - $data += ['is_filterable' => 0, 'is_filterable_in_search' => 0]; if ($model->getIsUserDefined() === null || $model->getIsUserDefined() != 0) { diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Frontend/Inputtype/Presentation.php b/app/code/Magento/Catalog/Model/Product/Attribute/Frontend/Inputtype/Presentation.php index 28e0f22fc6ec9..03b8c7aa1cadc 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Frontend/Inputtype/Presentation.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Frontend/Inputtype/Presentation.php @@ -4,6 +4,8 @@ * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Catalog\Model\Product\Attribute\Frontend\Inputtype; use Magento\Catalog\Model\ResourceModel\Eav\Attribute; @@ -19,9 +21,9 @@ class Presentation * Get input type for presentation layer from stored input type. * * @param Attribute $attribute - * @return string + * @return string|null */ - public function getPresentationInputType(Attribute $attribute) + public function getPresentationInputType(Attribute $attribute) :?string { $inputType = $attribute->getFrontendInput(); if ($inputType == 'textarea' && $attribute->getIsWysiwygEnabled()) { @@ -37,12 +39,12 @@ public function getPresentationInputType(Attribute $attribute) * * @return array */ - public function convertPresentationDataToInputType(array $data) + public function convertPresentationDataToInputType(array $data) : array { - if ($data['frontend_input'] === 'texteditor') { + if (isset($data['frontend_input']) && $data['frontend_input'] === 'texteditor') { $data['is_wysiwyg_enabled'] = 1; $data['frontend_input'] = 'textarea'; - } elseif ($data['frontend_input'] === 'textarea') { + } elseif (isset($data['frontend_input']) && $data['frontend_input'] === 'textarea') { $data['is_wysiwyg_enabled'] = 0; } return $data; diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Frontend/InputType/PresentationTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Frontend/InputType/PresentationTest.php new file mode 100644 index 0000000000000..16dff2d210f27 --- /dev/null +++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/Frontend/InputType/PresentationTest.php @@ -0,0 +1,80 @@ +presentation = new \Magento\Catalog\Model\Product\Attribute\Frontend\Inputtype\Presentation(); + $this->attributeMock = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** + * @param string $inputType + * @param boolean $isWysiwygEnabled + * @param string $expectedResult + * @dataProvider getPresentationInputTypeDataProvider + */ + public function testGetPresentationInputType(string $inputType, bool $isWysiwygEnabled, string $expectedResult) + { + $this->attributeMock->expects($this->once())->method('getFrontendInput')->willReturn($inputType); + $this->attributeMock->expects($this->any())->method('getIsWysiwygEnabled')->willReturn($isWysiwygEnabled); + $this->assertEquals($expectedResult, $this->presentation->getPresentationInputType($this->attributeMock)); + } + + public function getPresentationInputTypeDataProvider() + { + return [ + 'attribute_is_textarea_and_wysiwyg_enabled' => ['textarea', true, 'texteditor'], + 'attribute_is_input_and_wysiwyg_enabled' => ['input', true, 'input'], + 'attribute_is_textarea_and_wysiwyg_disabled' => ['textarea', false, 'textarea'], + ]; + } + + /** + * @param array $data + * @param array $expectedResult + * @dataProvider convertPresentationDataToInputTypeDataProvider + */ + public function testConvertPresentationDataToInputType(array $data, array $expectedResult) + { + $this->assertEquals($expectedResult, $this->presentation->convertPresentationDataToInputType($data)); + } + + public function convertPresentationDataToInputTypeDataProvider() + { + return [ + [['key' => 'value'], ['key' => 'value']], + [ + ['frontend_input' => 'texteditor'], + ['frontend_input' => 'textarea', 'is_wysiwyg_enabled' => 1] + ], + [ + ['frontend_input' => 'textarea'], + ['frontend_input' => 'textarea', 'is_wysiwyg_enabled' => 0] + ], + [ + ['frontend_input' => 'input'], + ['frontend_input' => 'input'] + ] + ]; + } +} diff --git a/app/code/Magento/Catalog/view/base/web/js/price-options.js b/app/code/Magento/Catalog/view/base/web/js/price-options.js index ceeea4c878622..e18abe3af38a6 100644 --- a/app/code/Magento/Catalog/view/base/web/js/price-options.js +++ b/app/code/Magento/Catalog/view/base/web/js/price-options.js @@ -20,8 +20,10 @@ define([ optionConfig: {}, optionHandlers: {}, optionTemplate: '<%= data.label %>' + - '<% if (data.finalPrice.value) { %>' + + '<% if (data.finalPrice.value > 0) { %>' + ' +<%- data.finalPrice.formatted %>' + + '<% } else if (data.finalPrice.value < 0) { %>' + + ' <%- data.finalPrice.formatted %>' + '<% } %>', controlContainer: 'dd' }; diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/SortFields.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/SortFields.php new file mode 100644 index 0000000000000..ca68b29910118 --- /dev/null +++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/SortFields.php @@ -0,0 +1,82 @@ +valueFactory = $valueFactory; + $this->catalogConfig = $catalogConfig; + $this->storeManager = $storeManager; + $this->sortbyAttributeSource = $sortbyAttributeSource; + } + + /** + * {@inheritDoc} + */ + public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) : Value + { + $sortFieldsOptions = $this->sortbyAttributeSource->getAllOptions(); + array_walk( + $sortFieldsOptions, + function (&$option) { + $option['label'] = (string)$option['label']; + } + ); + $data = [ + 'default' => $this->catalogConfig->getProductListDefaultSortBy($this->storeManager->getStore()->getId()), + 'options' => $sortFieldsOptions, + ]; + + $result = function () use ($data) { + return $data; + }; + + return $this->valueFactory->create($result); + } +} diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/CanonicalUrl.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/CanonicalUrl.php new file mode 100644 index 0000000000000..d2675848c2d2a --- /dev/null +++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/CanonicalUrl.php @@ -0,0 +1,62 @@ +valueFactory = $valueFactory; + } + + /** + * {@inheritdoc} + */ + public function resolve( + Field $field, + $context, + ResolveInfo $info, + array $value = null, + array $args = null + ): Value { + if (!isset($value['model'])) { + $result = function () { + return null; + }; + return $this->valueFactory->create($result); + } + + /* @var $product Product */ + $product = $value['model']; + $url = $product->getUrlModel()->getUrl($product, ['_ignore_category' => true]); + $result = function () use ($url) { + return $url; + }; + + return $this->valueFactory->create($result); + } +} diff --git a/app/code/Magento/CatalogGraphQl/Test/Unit/Model/Resolver/Product/CanonicalUrlTest.php b/app/code/Magento/CatalogGraphQl/Test/Unit/Model/Resolver/Product/CanonicalUrlTest.php new file mode 100644 index 0000000000000..ae01c67eb5224 --- /dev/null +++ b/app/code/Magento/CatalogGraphQl/Test/Unit/Model/Resolver/Product/CanonicalUrlTest.php @@ -0,0 +1,92 @@ +getMockBuilder(\Magento\Framework\GraphQl\Config\Element\Field::class) + ->disableOriginalConstructor() + ->getMock(); + $mockInfo = $this->getMockBuilder(\Magento\Framework\GraphQl\Schema\Type\ResolveInfo::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->mockValueFactory->method('create')->with( + $this->callback( + function ($param) { + return $param() === null; + } + ) + ); + + $this->subject->resolve($mockField, '', $mockInfo, [], []); + } + + protected function setUp() + { + parent::setUp(); + $this->objectManager = new ObjectManager($this); + $this->mockStoreManager = $this->getMockBuilder(StoreManagerInterface::class)->getMock(); + $this->mockValueFactory = $this->getMockBuilder(ValueFactory::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->mockValueFactory->method('create')->willReturn( + $this->objectManager->getObject( + Value::class, + ['callback' => function () { + return ''; + }] + ) + ); + + $mockProductUrlPathGenerator = $this->getMockBuilder(ProductUrlPathGenerator::class) + ->disableOriginalConstructor() + ->getMock(); + $mockProductUrlPathGenerator->method('getUrlPathWithSuffix')->willReturn('product_url.html'); + + $this->subject = $this->objectManager->getObject( + CanonicalUrl::class, + [ + 'valueFactory' => $this->mockValueFactory, + 'storeManager' => $this->mockStoreManager, + 'productUrlPathGenerator' => $mockProductUrlPathGenerator + ] + ); + } +} diff --git a/app/code/Magento/CatalogGraphQl/etc/schema.graphqls b/app/code/Magento/CatalogGraphQl/etc/schema.graphqls index ca1ff78654319..747d1446ad0c5 100644 --- a/app/code/Magento/CatalogGraphQl/etc/schema.graphqls +++ b/app/code/Magento/CatalogGraphQl/etc/schema.graphqls @@ -279,6 +279,7 @@ interface ProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\ gift_message_available: String @doc(description: "Indicates whether a gift message is available") manufacturer: Int @doc(description: "A number representing the product's manufacturer") categories: [CategoryInterface] @doc(description: "The categories assigned to a product") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Category") + canonical_url: String @doc(description: "Canonical URL") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\CanonicalUrl") } interface PhysicalProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\\ProductInterfaceTypeResolverComposite") @doc(description: "PhysicalProductInterface contains attributes specific to tangible products") { @@ -402,6 +403,7 @@ type Products @doc(description: "The Products object is the top-level object ret page_info: SearchResultPageInfo @doc(description: "An object that includes the page_info and currentPage values specified in the query") total_count: Int @doc(description: "The number of products returned") filters: [LayerFilter] @doc(description: "Layered navigation filters array") + sort_fields: SortFields @doc(description: "An object that includes the default sort field and all available sort fields") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Category\\SortFields") } input ProductFilterInput @doc(description: "ProductFilterInput defines the filters to be used in the search. A filter contains at least one attribute, a comparison operator, and the value that is being searched for.") { @@ -521,3 +523,13 @@ interface LayerFilterItemInterface @typeResolver(class: "Magento\\CatalogGraphQl type LayerFilterItem implements LayerFilterItemInterface { } + +type SortField { + value: String @doc(description: "Attribute code of sort field") + label: String @doc(description: "Label of sort field") +} + +type SortFields @doc(description: "SortFields contains a default value for sort fields and all available sort fields") { + default: String @doc(description: "Default value of sort fields") + options: [SortField] @doc(description: "Available sort fields") +} diff --git a/app/code/Magento/Checkout/view/frontend/web/js/shopping-cart.js b/app/code/Magento/Checkout/view/frontend/web/js/shopping-cart.js index 399321bd2f67d..3ea49cd981d90 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/shopping-cart.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/shopping-cart.js @@ -12,7 +12,7 @@ define([ $.widget('mage.shoppingCart', { /** @inheritdoc */ _create: function () { - var items, i; + var items, i, reload; $(this.options.emptyCartButton).on('click', $.proxy(function () { $(this.options.emptyCartButton).attr('name', 'update_cart_action_temp'); @@ -36,6 +36,27 @@ define([ $(this.options.continueShoppingButton).on('click', $.proxy(function () { location.href = this.options.continueShoppingUrl; }, this)); + + $(document).on('ajax:removeFromCart', $.proxy(function () { + reload = true; + $('div.block.block-minicart').on('dropdowndialogclose', $.proxy(function () { + if (reload === true) { + location.reload(); + reload = false; + } + $('div.block.block-minicart').off('dropdowndialogclose'); + })); + }, this)); + $(document).on('ajax:updateItemQty', $.proxy(function () { + reload = true; + $('div.block.block-minicart').on('dropdowndialogclose', $.proxy(function () { + if (reload === true) { + location.reload(); + reload = false; + } + $('div.block.block-minicart').off('dropdowndialogclose'); + })); + }, this)); } }); diff --git a/app/code/Magento/Checkout/view/frontend/web/js/sidebar.js b/app/code/Magento/Checkout/view/frontend/web/js/sidebar.js index dab40f026645d..3fb8743e951c8 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/sidebar.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/sidebar.js @@ -220,6 +220,7 @@ define([ */ _updateItemQtyAfter: function (elem) { this._hideItemButton(elem); + $(document).trigger('ajax:updateItemQty'); }, /** diff --git a/app/code/Magento/Cms/Model/Wysiwyg/DefaultConfigProvider.php b/app/code/Magento/Cms/Model/Wysiwyg/DefaultConfigProvider.php index dee37c8e901ec..2ff2aa3f82ba8 100644 --- a/app/code/Magento/Cms/Model/Wysiwyg/DefaultConfigProvider.php +++ b/app/code/Magento/Cms/Model/Wysiwyg/DefaultConfigProvider.php @@ -4,6 +4,8 @@ * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Cms\Model\Wysiwyg; /** @@ -27,7 +29,7 @@ public function __construct(\Magento\Framework\View\Asset\Repository $assetRepo) /** * {@inheritdoc} */ - public function getConfig($config) + public function getConfig(\Magento\Framework\DataObject $config) : \Magento\Framework\DataObject { $config->addData([ 'tinymce4' => [ diff --git a/app/code/Magento/Cms/Model/Wysiwyg/Gallery/DefaultConfigProvider.php b/app/code/Magento/Cms/Model/Wysiwyg/Gallery/DefaultConfigProvider.php index 2301cf9950ecc..822f9ce2b1cb5 100644 --- a/app/code/Magento/Cms/Model/Wysiwyg/Gallery/DefaultConfigProvider.php +++ b/app/code/Magento/Cms/Model/Wysiwyg/Gallery/DefaultConfigProvider.php @@ -4,6 +4,8 @@ * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Cms\Model\Wysiwyg\Gallery; class DefaultConfigProvider implements \Magento\Framework\Data\Wysiwyg\ConfigProviderInterface @@ -49,7 +51,7 @@ public function __construct( /** * {@inheritdoc} */ - public function getConfig($config) + public function getConfig(\Magento\Framework\DataObject $config) : \Magento\Framework\DataObject { $pluginData = (array) $config->getData('plugins'); $imageData = [ diff --git a/app/code/Magento/Cms/Model/WysiwygDefaultConfig.php b/app/code/Magento/Cms/Model/WysiwygDefaultConfig.php index c03629188798b..b0f7260d209ea 100644 --- a/app/code/Magento/Cms/Model/WysiwygDefaultConfig.php +++ b/app/code/Magento/Cms/Model/WysiwygDefaultConfig.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Cms\Model; class WysiwygDefaultConfig implements \Magento\Framework\Data\Wysiwyg\ConfigProviderInterface @@ -10,7 +12,7 @@ class WysiwygDefaultConfig implements \Magento\Framework\Data\Wysiwyg\ConfigProv /** * {@inheritdoc} */ - public function getConfig($config) + public function getConfig(\Magento\Framework\DataObject $config) : \Magento\Framework\DataObject { return $config; } diff --git a/app/code/Magento/Customer/Model/Customer/NotificationStorage.php b/app/code/Magento/Customer/Model/Customer/NotificationStorage.php index 7054324851f34..11e0b9b916559 100644 --- a/app/code/Magento/Customer/Model/Customer/NotificationStorage.php +++ b/app/code/Magento/Customer/Model/Customer/NotificationStorage.php @@ -5,6 +5,7 @@ */ namespace Magento\Customer\Model\Customer; +use Magento\Framework\App\ObjectManager; use Magento\Framework\Cache\FrontendInterface; use Magento\Framework\Serialize\SerializerInterface; @@ -18,21 +19,21 @@ class NotificationStorage private $cache; /** - * @param FrontendInterface $cache - */ - - /** - * @param FrontendInterface $cache + * @var SerializerInterface */ private $serializer; /** * NotificationStorage constructor. * @param FrontendInterface $cache + * @param SerializerInterface $serializer */ - public function __construct(FrontendInterface $cache) - { + public function __construct( + FrontendInterface $cache, + SerializerInterface $serializer = null + ) { $this->cache = $cache; + $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class); } /** @@ -45,7 +46,7 @@ public function __construct(FrontendInterface $cache) public function add($notificationType, $customerId) { $this->cache->save( - $this->getSerializer()->serialize([ + $this->serializer->serialize([ 'customer_id' => $customerId, 'notification_type' => $notificationType ]), @@ -88,19 +89,4 @@ private function getCacheKey($notificationType, $customerId) { return 'notification_' . $notificationType . '_' . $customerId; } - - /** - * Get serializer - * - * @return SerializerInterface - * @deprecated 100.2.0 - */ - private function getSerializer() - { - if ($this->serializer === null) { - $this->serializer = \Magento\Framework\App\ObjectManager::getInstance() - ->get(SerializerInterface::class); - } - return $this->serializer; - } } diff --git a/app/code/Magento/GraphQl/etc/schema.graphqls b/app/code/Magento/GraphQl/etc/schema.graphqls index ffdf5511b7492..37ca2d8d7b378 100644 --- a/app/code/Magento/GraphQl/etc/schema.graphqls +++ b/app/code/Magento/GraphQl/etc/schema.graphqls @@ -30,4 +30,4 @@ type SearchResultPageInfo @doc(description: "SearchResultPageInfo provides navig enum SortEnum @doc(description: "This enumeration indicates whether to return results in ascending or descending order") { ASC DESC -} +} \ No newline at end of file diff --git a/app/code/Magento/InstantPurchase/Model/InstantPurchaseOption.php b/app/code/Magento/InstantPurchase/Model/InstantPurchaseOption.php index 214b93560669f..0748c5818c857 100644 --- a/app/code/Magento/InstantPurchase/Model/InstantPurchaseOption.php +++ b/app/code/Magento/InstantPurchase/Model/InstantPurchaseOption.php @@ -20,22 +20,22 @@ class InstantPurchaseOption { /** - * @var PaymentTokenInterface + * @var PaymentTokenInterface|null */ private $paymentToken; /** - * @var AddressIn + * @var Address|null */ private $shippingAddress; /** - * @var Address + * @var Address|null */ private $billingAddress; /** - * @var ShippingMethodInterface + * @var ShippingMethodInterface|null */ private $shippingMethod; diff --git a/app/code/Magento/InstantPurchase/Model/InstantPurchaseOptionLoadingFactory.php b/app/code/Magento/InstantPurchase/Model/InstantPurchaseOptionLoadingFactory.php index d1dc71b80d5d1..b203cfdad2221 100644 --- a/app/code/Magento/InstantPurchase/Model/InstantPurchaseOptionLoadingFactory.php +++ b/app/code/Magento/InstantPurchase/Model/InstantPurchaseOptionLoadingFactory.php @@ -100,7 +100,7 @@ public function create( /** * Loads customer address model by identifier. * - * @param $addressId + * @param int $addressId * @return Address */ private function getAddress($addressId): Address diff --git a/app/code/Magento/InstantPurchase/Model/ShippingMethodChoose/DeferredShippingMethodChooserPool.php b/app/code/Magento/InstantPurchase/Model/ShippingMethodChoose/DeferredShippingMethodChooserPool.php index 96c01cdbb6663..ca0e9351967ad 100644 --- a/app/code/Magento/InstantPurchase/Model/ShippingMethodChoose/DeferredShippingMethodChooserPool.php +++ b/app/code/Magento/InstantPurchase/Model/ShippingMethodChoose/DeferredShippingMethodChooserPool.php @@ -39,7 +39,7 @@ public function get($type) : DeferredShippingMethodChooserInterface { if (!isset($this->choosers[$type])) { throw new \InvalidArgumentException(sprintf( - 'Deferred shipping method chooser is not registered.', + 'Deferred shipping method %s is not registered.', $type )); } diff --git a/app/code/Magento/InstantPurchase/PaymentMethodIntegration/IntegrationsManager.php b/app/code/Magento/InstantPurchase/PaymentMethodIntegration/IntegrationsManager.php index 9c93febe0db36..3ad2e000e97d3 100644 --- a/app/code/Magento/InstantPurchase/PaymentMethodIntegration/IntegrationsManager.php +++ b/app/code/Magento/InstantPurchase/PaymentMethodIntegration/IntegrationsManager.php @@ -146,7 +146,7 @@ private function findIntegrations(int $storeId): array * * * @param VaultPaymentInterface $paymentMethod - * @param $storeId + * @param int|string|null|\Magento\Store\Model\Store $storeId * @return bool */ private function isIntegrationAvailable(VaultPaymentInterface $paymentMethod, $storeId): bool diff --git a/app/code/Magento/Paypal/Model/Api/Nvp.php b/app/code/Magento/Paypal/Model/Api/Nvp.php index 6933c613ef748..25883590350f4 100644 --- a/app/code/Magento/Paypal/Model/Api/Nvp.php +++ b/app/code/Magento/Paypal/Model/Api/Nvp.php @@ -1025,7 +1025,7 @@ public function callGetPalDetails() } /** - * Set Customer BillingA greement call + * Set Customer BillingAgreement call * * @return void * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetCustomerBillingAgreement @@ -1425,7 +1425,7 @@ protected function _deformatNVP($nvpstr) $nvpstr = strpos($nvpstr, "\r\n\r\n") !== false ? substr($nvpstr, strpos($nvpstr, "\r\n\r\n") + 4) : $nvpstr; while (strlen($nvpstr)) { - //postion of Key + //position of Key $keypos = strpos($nvpstr, '='); //position of value $valuepos = strpos($nvpstr, '&') ? strpos($nvpstr, '&') : strlen($nvpstr); @@ -1433,7 +1433,7 @@ protected function _deformatNVP($nvpstr) /*getting the Key and Value values and storing in a Associative Array*/ $keyval = substr($nvpstr, $intial, $keypos); $valval = substr($nvpstr, $keypos + 1, $valuepos - $keypos - 1); - //decoding the respose + //decoding the response $nvpArray[urldecode($keyval)] = urldecode($valval); $nvpstr = substr($nvpstr, $valuepos + 1, strlen($nvpstr)); } diff --git a/app/code/Magento/Rule/view/adminhtml/web/conditions-data-normalizer.js b/app/code/Magento/Rule/view/adminhtml/web/conditions-data-normalizer.js new file mode 100644 index 0000000000000..c9c36c4fa585a --- /dev/null +++ b/app/code/Magento/Rule/view/adminhtml/web/conditions-data-normalizer.js @@ -0,0 +1,140 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'jquery', + 'underscore' +], function ($, _) { + 'use strict'; + + /** + * @constructor + */ + var ConditionsDataNormalizer = function () { + this.patterns = { + validate: /^[a-z0-9_-][a-z0-9_-]*(?:\[(?:\d*|[a-z0-9_-]+)\])*$/i, + key: /[a-z0-9_-]+|(?=\[\])/gi, + push: /^$/, + fixed: /^\d+$/, + named: /^[a-z0-9_-]+$/i + }; + }; + + ConditionsDataNormalizer.prototype = { + /** + * Will convert an object: + * { + * "foo[bar][1][baz]": 123, + * "foo[bar][1][blah]": 321 + * "foo[bar][1--1][ah]": 456 + * } + * + * to + * { + * "foo": { + * "bar": { + * "1": { + * "baz": 123, + * "blah": 321 + * }, + * "1--1": { + * "ah": 456 + * } + * } + * } + * } + */ + normalize: function normalize(value) { + var el, _this = this; + + this.pushes = {}; + this.data = {}; + + _.each(value, function (e, i) { + el = {}; + el[i] = e; + + _this._addPair({ + name: i, + value: e + }); + }); + + return this.data; + }, + + /** + * @param {Object} base + * @param {String} key + * @param {String} value + * @return {Object} + * @private + */ + _build: function build(base, key, value) { + base[key] = value; + + return base; + }, + + /** + * @param {Object} root + * @param {String} value + * @return {*} + * @private + */ + _makeObject: function makeObject(root, value) { + var keys = root.match(this.patterns.key), + k, idx; // nest, nest, ..., nest + + while ((k = keys.pop()) !== undefined) { + // foo[] + if (this.patterns.push.test(k)) { + idx = this._incrementPush(root.replace(/\[\]$/, '')); + value = this._build([], idx, value); + } // foo[n] + else if (this.patterns.fixed.test(k)) { + value = this._build({}, k, value); + } // foo; foo[bar] + else if (this.patterns.named.test(k)) { + value = this._build({}, k, value); + } + } + + return value; + }, + + /** + * @param {String} key + * @return {Number} + * @private + */ + _incrementPush: function incrementPush(key) { + if (this.pushes[key] === undefined) { + this.pushes[key] = 0; + } + + return this.pushes[key]++; + }, + + /** + * @param {Object} pair + * @return {Object} + * @private + */ + _addPair: function addPair(pair) { + var obj = this._makeObject(pair.name, pair.value); + + if (!this.patterns.validate.test(pair.name)) { + return this; + } + + this.data = $.extend(true, this.data, obj); + + return this; + } + }; + + return ConditionsDataNormalizer; +}); diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php index 2944b8ccef647..92d00d0436634 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php @@ -131,14 +131,17 @@ protected function prepareTemplate(Order $order) 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order), ]; - $transport = new DataObject($transport); + $transportObject = new DataObject($transport); + /** + * Event argument `transport` is @deprecated. Use `transportObject` instead. + */ $this->eventManager->dispatch( 'email_order_set_template_vars_before', - ['sender' => $this, 'transport' => $transport] + ['sender' => $this, 'transport' => $transportObject->getData(), 'transportObject' => $transportObject] ); - $this->templateContainer->setTemplateVars($transport->getData()); + $this->templateContainer->setTemplateVars($transportObject->getData()); parent::prepareTemplate($order); } diff --git a/app/code/Magento/Tinymce3/Model/Config/Source/Wysiwyg/Editor.php b/app/code/Magento/Tinymce3/Model/Config/Source/Wysiwyg/Editor.php index c01b036225a1a..00f1a82698381 100644 --- a/app/code/Magento/Tinymce3/Model/Config/Source/Wysiwyg/Editor.php +++ b/app/code/Magento/Tinymce3/Model/Config/Source/Wysiwyg/Editor.php @@ -3,8 +3,14 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Tinymce3\Model\Config\Source\Wysiwyg; +/** + * Class Editor provides configuration value for TinyMCE3 editor + * @deprecated use as configuration value tinymce4 path: mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter + */ class Editor { /** diff --git a/app/code/Magento/Tinymce3/Model/Config/Variable/Config.php b/app/code/Magento/Tinymce3/Model/Config/Variable/Config.php index 59c3b529fdc37..2d016a5101abe 100644 --- a/app/code/Magento/Tinymce3/Model/Config/Variable/Config.php +++ b/app/code/Magento/Tinymce3/Model/Config/Variable/Config.php @@ -3,10 +3,13 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +declare(strict_types=1); namespace Magento\Tinymce3\Model\Config\Variable; /** * Class Config adds variable plugin information required for tinymce3 editor + * @deprecated use \Magento\Variable\Model\Variable\ConfigProvider instead */ class Config implements \Magento\Framework\Data\Wysiwyg\ConfigProviderInterface { @@ -38,7 +41,7 @@ public function __construct( * @param \Magento\Framework\DataObject $config * @return \Magento\Framework\DataObject */ - public function getConfig($config) + public function getConfig(\Magento\Framework\DataObject $config) : \Magento\Framework\DataObject { $settings = $this->defaultVariableConfig->getWysiwygPluginSettings($config); $pluginConfig = isset($settings['plugins']) ? $settings['plugins'] : []; diff --git a/app/code/Magento/Tinymce3/Model/Config/Widget/Config.php b/app/code/Magento/Tinymce3/Model/Config/Widget/Config.php index 81c814681ea8c..de548df4bc9f3 100644 --- a/app/code/Magento/Tinymce3/Model/Config/Widget/Config.php +++ b/app/code/Magento/Tinymce3/Model/Config/Widget/Config.php @@ -3,10 +3,13 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Tinymce3\Model\Config\Widget; /** * Class Config adds widget plugin information required for tinymce3 editor + * @deprecated use \Magento\Widget\Model\Widget\Config instead */ class Config implements \Magento\Framework\Data\Wysiwyg\ConfigProviderInterface { @@ -35,7 +38,7 @@ public function __construct( /** * {@inheritdoc} */ - public function getConfig($config) + public function getConfig(\Magento\Framework\DataObject $config) : \Magento\Framework\DataObject { $settings = [ 'widget_plugin_src' => $this->getWysiwygJsPluginSrc(), @@ -52,7 +55,7 @@ public function getConfig($config) * * @return string */ - private function getWysiwygJsPluginSrc() + private function getWysiwygJsPluginSrc() : string { $editorPluginJs = 'Magento_Tinymce3::tiny_mce/plugins/magentowidget/editor_plugin.js'; $result = $this->assetRepo->getUrl($editorPluginJs); diff --git a/app/code/Magento/Tinymce3/Model/Config/Widget/PlaceholderImagesPool.php b/app/code/Magento/Tinymce3/Model/Config/Widget/PlaceholderImagesPool.php index ba570ab12494f..1ab3de708dd26 100644 --- a/app/code/Magento/Tinymce3/Model/Config/Widget/PlaceholderImagesPool.php +++ b/app/code/Magento/Tinymce3/Model/Config/Widget/PlaceholderImagesPool.php @@ -3,11 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - +declare(strict_types=1); namespace Magento\Tinymce3\Model\Config\Widget; /** * Class PlaceholderImages provide ability to override placeholder images for Widgets + * @deprecated */ class PlaceholderImagesPool { @@ -29,7 +30,7 @@ public function __construct( /** * @return array */ - public function getWidgetPlaceholders() + public function getWidgetPlaceholders() : array { return $this->widgetPlaceholders; } diff --git a/app/code/Magento/Tinymce3/Model/Config/Wysiwyg/Config.php b/app/code/Magento/Tinymce3/Model/Config/Wysiwyg/Config.php index 1e8b57996954b..f3dc4c8591cbd 100644 --- a/app/code/Magento/Tinymce3/Model/Config/Wysiwyg/Config.php +++ b/app/code/Magento/Tinymce3/Model/Config/Wysiwyg/Config.php @@ -3,10 +3,13 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Tinymce3\Model\Config\Wysiwyg; /** * Class Config adds information about required css files for tinymce3 editor + * @deprecated use \Magento\Cms\Model\Wysiwyg\DefaultConfigProvider instead */ class Config implements \Magento\Framework\Data\Wysiwyg\ConfigProviderInterface { @@ -27,7 +30,7 @@ public function __construct( /** * {@inheritdoc} */ - public function getConfig($config) + public function getConfig(\Magento\Framework\DataObject $config) : \Magento\Framework\DataObject { $config->addData([ 'popup_css' => $this->assetRepo->getUrl( diff --git a/app/code/Magento/Tinymce3/Model/Plugin/Widget.php b/app/code/Magento/Tinymce3/Model/Plugin/Widget.php index 408dee97b4ed8..1cf8a67751b76 100644 --- a/app/code/Magento/Tinymce3/Model/Plugin/Widget.php +++ b/app/code/Magento/Tinymce3/Model/Plugin/Widget.php @@ -3,6 +3,8 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +declare(strict_types=1); namespace Magento\Tinymce3\Model\Plugin; use Magento\Tinymce3\Model\Config\Source\Wysiwyg\Editor; @@ -44,16 +46,16 @@ public function __construct( /** * @param \Magento\Widget\Model\Widget $subject - * @param $proceed - * @param $type + * @param \Closure $proceed + * @param string $type * @return string * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function aroundGetPlaceholderImageUrl( \Magento\Widget\Model\Widget $subject, - $proceed, - $type - ) { + \Closure $proceed, + string $type + ) : string { if ($this->activeEditor->getWysiwygAdapterPath() !== Editor::WYSIWYG_EDITOR_CONFIG_VALUE) { return $proceed($type); } diff --git a/app/code/Magento/Tinymce3/README.md b/app/code/Magento/Tinymce3/README.md index 9fb0473fadedd..8e24c218171b6 100644 --- a/app/code/Magento/Tinymce3/README.md +++ b/app/code/Magento/Tinymce3/README.md @@ -1,3 +1 @@ -This moodule provides backwards compatibility for TinyMCE3 for clients -that have modified the TinyMCE3 editor in Magento and don't want to -lose functionality. \ No newline at end of file +We have updated the TinyMCE module to the latest available version, 4.6.4. TinyMCE v4.6.4 provides backwards-compatibility for modified editor modules to prevent the loss of functionality. The TinyMCE3 module is now deprecated and will be removed in a future release. \ No newline at end of file diff --git a/app/code/Magento/Tinymce3/etc/di.xml b/app/code/Magento/Tinymce3/etc/di.xml new file mode 100644 index 0000000000000..e03d865ce4e01 --- /dev/null +++ b/app/code/Magento/Tinymce3/etc/di.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + diff --git a/app/code/Magento/Tinymce3/view/adminhtml/web/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js b/app/code/Magento/Tinymce3/view/adminhtml/web/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js index 560a60e98bc83..f332d4c88c615 100644 --- a/app/code/Magento/Tinymce3/view/adminhtml/web/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js +++ b/app/code/Magento/Tinymce3/view/adminhtml/web/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js @@ -3,6 +3,9 @@ * See COPYING.txt for license details. */ +/** + * @deprecated use lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js instead + */ /* global tinyMCE, tinymce, MagentovariablePlugin */ /* eslint-disable strict */ tinyMCE.addI18n({ diff --git a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js index 474861a523878..88e2d4cc78f96 100644 --- a/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js +++ b/app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js @@ -3,6 +3,9 @@ * See COPYING.txt for license details. */ +/** + * @deprecated use lib/web/mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter.js instead + */ /* global varienGlobalEvents, tinyMceEditors, MediabrowserUtility, closeEditorPopup, Base64 */ /* eslint-disable strict */ define([ diff --git a/app/code/Magento/Translation/Block/Html/Head/Config.php b/app/code/Magento/Translation/Block/Html/Head/Config.php index 20a67409212e1..422564abfbc7b 100644 --- a/app/code/Magento/Translation/Block/Html/Head/Config.php +++ b/app/code/Magento/Translation/Block/Html/Head/Config.php @@ -34,7 +34,6 @@ class Config extends \Magento\Framework\View\Element\AbstractBlock /** * @param \Magento\Framework\View\Element\Context $context - * @param RequireJsConfig $config * @param \Magento\Framework\View\Page\Config $pageConfig * @param \Magento\Translation\Model\FileManager $fileManager * @param Inline $inline diff --git a/app/code/Magento/Ui/Block/Wysiwyg/ActiveEditor.php b/app/code/Magento/Ui/Block/Wysiwyg/ActiveEditor.php index ac0af00f9682d..b6077b7b1625d 100644 --- a/app/code/Magento/Ui/Block/Wysiwyg/ActiveEditor.php +++ b/app/code/Magento/Ui/Block/Wysiwyg/ActiveEditor.php @@ -16,20 +16,34 @@ */ class ActiveEditor extends \Magento\Framework\View\Element\Template { + const DEFAULT_EDITOR_PATH = 'mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter'; + /** * @var ScopeConfigInterface */ private $scopeConfig; /** + * @var array + */ + private $availableAdapterPaths; + + /** + * ActiveEditor constructor. * @param Context $context * @param ScopeConfigInterface $scopeConfig + * @param array $availableAdapterPaths * @param array $data */ - public function __construct(Context $context, ScopeConfigInterface $scopeConfig, array $data = []) - { + public function __construct( + Context $context, + ScopeConfigInterface $scopeConfig, + $availableAdapterPaths = [], + array $data = [] + ) { parent::__construct($context, $data); $this->scopeConfig = $scopeConfig; + $this->availableAdapterPaths = $availableAdapterPaths; } /** @@ -40,6 +54,9 @@ public function __construct(Context $context, ScopeConfigInterface $scopeConfig, public function getWysiwygAdapterPath() { $adapterPath = $this->scopeConfig->getValue(Model\Config::WYSIWYG_EDITOR_CONFIG_PATH); + if ($adapterPath !== self::DEFAULT_EDITOR_PATH && !isset($this->availableAdapterPaths[$adapterPath])) { + $adapterPath = self::DEFAULT_EDITOR_PATH; + } return $this->escapeHtml($adapterPath); } } 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 b6979121a1891..5177b4a378d69 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 @@ -220,7 +220,7 @@ define([ }, /** - * Sets 'value' as 'hidden' propertie's value, triggers 'toggle' event, + * Sets 'value' as 'hidden' property's value, triggers 'toggle' event, * sets instance's hidden identifier in params storage based on * 'value'. * diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/url-input.js b/app/code/Magento/Ui/view/base/web/js/form/element/url-input.js index 6c370919f11db..2bfce304b9adc 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/url-input.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/url-input.js @@ -55,6 +55,8 @@ define([ linkSettingsArray.name = baseLinkType.namePrefix + linkName; linkSettingsArray.dataScope = baseLinkType.dataScopePrefix + linkName; linkSettingsArray.type = linkName; + linkSettingsArray.disabled = config.disabled; + linkSettingsArray.visible = config.visible; processedLinkTypes[linkName] = {}; _.extend(processedLinkTypes[linkName], baseLinkType, linkSettingsArray); }); diff --git a/app/code/Magento/Variable/Model/Variable/ConfigProvider.php b/app/code/Magento/Variable/Model/Variable/ConfigProvider.php index 00eb4531b27b7..f6fe9dd880381 100644 --- a/app/code/Magento/Variable/Model/Variable/ConfigProvider.php +++ b/app/code/Magento/Variable/Model/Variable/ConfigProvider.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Variable\Model\Variable; @@ -30,7 +31,7 @@ public function __construct(Config $variableConfig) * {@inheritdoc} * */ - public function getConfig($config) + public function getConfig(\Magento\Framework\DataObject $config) : \Magento\Framework\DataObject { $settings = $this->variableConfig->getWysiwygPluginSettings($config); return $config->addData($settings); diff --git a/app/code/Magento/Vault/Model/PaymentTokenFactory.php b/app/code/Magento/Vault/Model/PaymentTokenFactory.php index e0b5d742fe8a4..6249fa4944a2c 100644 --- a/app/code/Magento/Vault/Model/PaymentTokenFactory.php +++ b/app/code/Magento/Vault/Model/PaymentTokenFactory.php @@ -22,6 +22,11 @@ class PaymentTokenFactory implements PaymentTokenFactoryInterface */ private $tokenTypes = []; + /** + * @var ObjectManagerInterface + */ + private $objectManager; + /** * PaymentTokenFactory constructor. * @param ObjectManagerInterface $objectManager diff --git a/app/code/Magento/Widget/Model/Widget/Config.php b/app/code/Magento/Widget/Model/Widget/Config.php index 0519f0b9d732a..4f81ef33f47f7 100644 --- a/app/code/Magento/Widget/Model/Widget/Config.php +++ b/app/code/Magento/Widget/Model/Widget/Config.php @@ -75,7 +75,7 @@ public function __construct( * @param \Magento\Framework\DataObject $config * @return \Magento\Framework\DataObject */ - public function getConfig($config) + public function getConfig(\Magento\Framework\DataObject $config) : \Magento\Framework\DataObject { $settings = $this->getPluginSettings($config); return $config->addData($settings); diff --git a/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_tooltip.less b/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_tooltip.less index cf84f34279086..273f626ec03d6 100644 --- a/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_tooltip.less +++ b/app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_tooltip.less @@ -8,7 +8,6 @@ // _____________________________________________ @checkout-tooltip__hover__z-index: @tooltip__z-index; -@checkout-tooltip-breakpoint__screen-m: @modal-popup-breakpoint-screen__m; @checkout-tooltip-icon-arrow__font-size: 10px; @checkout-tooltip-icon-arrow__left: -( @checkout-tooltip-content__padding + @checkout-tooltip-icon-arrow__font-size - @checkout-tooltip-content__border-width); @@ -138,7 +137,7 @@ } } -.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @checkout-tooltip-breakpoint__screen-m) { +.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) { .field-tooltip { .field-tooltip-content { &:extend(.abs-checkout-tooltip-content-position-top-mobile all); diff --git a/app/design/frontend/Magento/blank/Magento_Sales/web/css/source/_module.less b/app/design/frontend/Magento/blank/Magento_Sales/web/css/source/_module.less index 1ea1e2c483d0b..3847393a2f046 100644 --- a/app/design/frontend/Magento/blank/Magento_Sales/web/css/source/_module.less +++ b/app/design/frontend/Magento/blank/Magento_Sales/web/css/source/_module.less @@ -262,7 +262,7 @@ } .toolbar { - &:extend(.abs-add-clearfix-desktop all); + &:extend(.abs-add-clearfix-mobile all); .pages { float: right; 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 d324bbeac598f..d76630b5cea47 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 @@ -16,7 +16,6 @@ @modal-popup-title__font-size: 26px; @modal-popup-title-mobile__font-size: @font-size__base; -@modal-popup-breakpoint-screen__m: @screen__m; @modal-slide__first__indent-left: 44px; @modal-slide-mobile__background-color: @color-gray-light01; @@ -149,7 +148,7 @@ } } -.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @modal-popup-breakpoint-screen__m) { +.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) { .modal-popup { &.modal-slide { .modal-inner-wrap[class] { @@ -180,7 +179,7 @@ // Desktop // _____________________________________________ -.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @modal-popup-breakpoint-screen__m) { +.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) { .modal-popup { &.modal-slide { .modal-footer { diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_payments.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_payments.less index 3136056d9426d..dfe9125149a3b 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_payments.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_payments.less @@ -58,6 +58,10 @@ } } } + + #po_number { + margin-bottom: 20px; + } } .payment-method-title { diff --git a/app/design/frontend/Magento/luma/web/css/source/components/_modals_extend.less b/app/design/frontend/Magento/luma/web/css/source/components/_modals_extend.less index b3165a41964e5..e90d312aa7801 100644 --- a/app/design/frontend/Magento/luma/web/css/source/components/_modals_extend.less +++ b/app/design/frontend/Magento/luma/web/css/source/components/_modals_extend.less @@ -16,7 +16,6 @@ @modal-popup-title__font-size: 26px; @modal-popup-title-mobile__font-size: @font-size__base; -@modal-popup-breakpoint-screen__m: @screen__m; @modal-slide__first__indent-left: 44px; @modal-slide-mobile__background-color: @color-gray-light01; @@ -148,7 +147,7 @@ } } -.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @modal-popup-breakpoint-screen__m) { +.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) { .modal-popup { &.modal-slide { .modal-inner-wrap[class] { @@ -179,7 +178,7 @@ // Desktop // _____________________________________________ -.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @modal-popup-breakpoint-screen__m) { +.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) { .modal-popup { &.modal-slide { .modal-footer { diff --git a/bin/UpgradeScripts/2.3_upgrade_additions.php b/bin/UpgradeScripts/2.3_upgrade_additions.php new file mode 100644 index 0000000000000..1658c8a4e6681 --- /dev/null +++ b/bin/UpgradeScripts/2.3_upgrade_additions.php @@ -0,0 +1,251 @@ +#!/usr/bin/php +" [--composer=] + [--edition=] [--version=] [--repo=] + [--help] + +Required: + --root="" + Path to the Magento installation root directory + +Optional: + --composer="" + Path to the composer executable + - Default: The composer found in PATH + + --edition= + The Magento edition to upgrade to. Open Source = 'community', Commerce = 'enterprise' + - Default: The edition currently required in composer.json + + --version= + The Magento version to upgrade to + - Default: The value for the "version" field in composer.json + + --repo= + The Magento composer repository to pull new packages from + - Default: The Magento repository configured in composer.json + + --help + Display this message +SYNOPSIS +); + + +$opts = getopt('', [ + 'root:', + 'composer:', + 'edition:', + 'version:', + 'repo:', + 'help' +]); + +if (isset($opts['help'])) { + echo SYNOPSIS . PHP_EOL; + exit(0); +} + +try { + if (empty($opts['root'])) { + throw new BadMethodCallException("Magento root must be given with '--root'" . PHP_EOL . PHP_EOL . SYNOPSIS); + } + + $rootDir = $opts['root']; + if (!is_dir($rootDir)) { + throw new InvalidArgumentException("Magento root directory '$rootDir' does not exist"); + } + + $cmd = (!empty($opts['composer']) ? $opts['composer'] : 'composer') . " --working-dir='$rootDir'"; + $jsonData = json_decode(file_get_contents("$rootDir/composer.json"), true); + + $version = !empty($opts['version']) ? $opts['version'] : $jsonData['version']; + if (empty($version)) { + throw new InvalidArgumentException('Value not found for "version" field in composer.json'); + } + + if (!empty($opts['edition'])) { + $edition = $opts['edition']; + } + else { + $editionRegex = '|^magento/product\-(?[a-z]+)\-edition$|'; + + foreach (array_keys($jsonData["require"]) as $requiredPackage) { + if (preg_match($editionRegex, $requiredPackage, $matches)) { + $edition = $matches['edition']; + break; + } + } + if (empty($edition)) { + throw new InvalidArgumentException('No valid Magento edition found in composer.json requirements'); + } + } + + echo "Backing up $rootDir/composer.json" . PHP_EOL; + copy("$rootDir/composer.json", "$rootDir/composer.json.bak"); + + echo "Updating Magento product requirement to magento/product-$edition-edition=$version" . PHP_EOL; + if ($edition == "enterprise") { + execVerbose("$cmd remove --verbose magento/product-community-edition --no-update"); + } + execVerbose("$cmd require --verbose magento/product-$edition-edition=$version --no-update"); + + echo 'Updating "require-dev" section of composer.json' . PHP_EOL; + execVerbose("$cmd require --dev --verbose " . + "phpunit/phpunit:~6.2.0 " . + "friendsofphp/php-cs-fixer:~2.10.1 " . + "lusitanian/oauth:~0.8.10 " . + "pdepend/pdepend:2.5.2 " . + "sebastian/phpcpd:~3.0.0 " . + "squizlabs/php_codesniffer:3.2.2 --no-update"); + + execVerbose("$cmd remove --dev --verbose sjparkinson/static-review fabpot/php-cs-fixer --no-update"); + + echo 'Adding "Zend\\\\Mvc\\\\Controller\\\\": "setup/src/Zend/Mvc/Controller/" to "autoload":"psr-4"' . PHP_EOL; + $jsonData = json_decode(file_get_contents("$rootDir/composer.json"), true); + $jsonData["autoload"]["psr-4"]["Zend\\Mvc\\Controller\\"] = "setup/src/Zend/Mvc/Controller/"; + + $jsonData["version"] = $version; + file_put_contents("$rootDir/composer.json", json_encode($jsonData, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT)); + + if (file_exists("$rootDir/update")) { + echo "Replacing Magento/Updater" . PHP_EOL; + + $mageUrls = []; + if (isset($opts['repo'])) { + $mageUrls[] = $opts['repo']; + } + else { + $composerUrls = array_map(function ($r) { return $r["url"]; }, + array_filter($jsonData['repositories']), function ($r) { return $r["type"] == "composer"; }); + $mageUrls = array_filter($composerUrls, function($u) { return strpos($u, ".mage") !== false; }); + + if (count($mageUrls) == 0) { + throw new InvalidArgumentException('No Magento composer repository urls found in composer.json'); + } + } + + echo "Backing up $rootDir/update" . PHP_EOL; + rename("$rootDir/update", "$rootDir/update.bak"); + $newPackage = "magento/project-$edition-edition=$version"; + foreach ($mageUrls as $repoUrl) { + try { + deleteFilepath("$rootDir/temp_update"); + execVerbose("$cmd create-project --repository=$repoUrl $newPackage $rootDir/temp_update --no-install"); + rename("$rootDir/temp_update/update", "$rootDir/update"); + echo "Upgraded Magento/Updater from magento/project-$edition-edition $version on $repoUrl" . PHP_EOL; + unset($exception); + break; + } + catch (Exception $e) { + echo "Failed to find Magento package on $repoUrl" . PHP_EOL; + $exception = $e; + } + } + deleteFilepath("$rootDir/temp_update"); + + if (isset($exception)) { + throw $exception; + } + } +} catch (Exception $e) { + if ($e->getPrevious()) { + $message = (string)$e->getPrevious(); + } else { + $message = $e->getMessage(); + } + + try { + error_log($message . PHP_EOL . PHP_EOL . "Error encountered; resetting backups" . PHP_EOL); + if (file_exists("$rootDir/update.bak")) { + deleteFilepath("$rootDir/update_temp"); + deleteFilepath("$rootDir/update"); + rename("$rootDir/update.bak", "$rootDir/update"); + } + + if (file_exists("$rootDir/composer.json.bak")) { + deleteFilepath("$rootDir/composer.json"); + rename("$rootDir/composer.json.bak", "$rootDir/composer.json"); + } + } + catch (Exception $e) { + error_log($e->getMessage() . PHP_EOL); + } + + exit($e->getCode() == 0 ? 1 : $e->getCode()); +} + +/** + * Execute a command with automatic escaping of arguments + * + * @param string $command + * @return array + * @throws Exception + */ +function execVerbose($command) +{ + $args = func_get_args(); + $args = array_map('escapeshellarg', $args); + $args[0] = $command; + $command = call_user_func_array('sprintf', $args); + echo $command . PHP_EOL; + exec($command . " 2>&1", $output, $exitCode); + $outputString = join(PHP_EOL, $output); + if (0 !== $exitCode) { + throw new Exception($outputString, $exitCode); + } + echo $outputString . PHP_EOL; + return $output; +} + +/** + * Deletes a file or a directory and all its contents + * + * @param string $path + * @throws Exception + */ +function deleteFilepath($path) { + if (!file_exists($path)) { + return; + } + if (is_dir($path)) { + $files = array_diff(scandir($path), array('..', '.')); + foreach ($files as $file) { + deleteFilepath("$path/$file"); + } + rmdir($path); + } + else { + unlink($path); + } + if (file_exists($path)) { + throw new Exception("Failed to delete $path"); + } +} diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml index cc6a32e7223f9..2a8f57708c33b 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml @@ -78,6 +78,19 @@ 1000 simple EavStockItem + CustomAttributeCategoryIds + + + testSku + simple + 4 + 4 + OutOfStockProduct + 123.00 + testurlkey + 1 + 0 + CustomAttributeCategoryIds 321.00 diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormSection.xml index efc2de3c007e5..926d87e889931 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormSection.xml @@ -46,7 +46,6 @@ - diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeTest.xml index 4e73647e596b2..7b0135973e211 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeTest.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Test/AdminEditTextEditorProductAttributeTest.xml @@ -16,8 +16,6 @@ - - diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogInventory/ActionGroup/DisplayOutOfStockProductActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogInventory/ActionGroup/DisplayOutOfStockProductActionGroup.xml new file mode 100644 index 0000000000000..b75cbff116761 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogInventory/ActionGroup/DisplayOutOfStockProductActionGroup.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogInventory/Page/InventoryConfigurationPage.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogInventory/Page/InventoryConfigurationPage.xml new file mode 100644 index 0000000000000..d138aadb144d8 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogInventory/Page/InventoryConfigurationPage.xml @@ -0,0 +1,12 @@ + + + + +
+ + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogInventory/Section/InventorySection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogInventory/Section/InventorySection.xml new file mode 100644 index 0000000000000..526d8b5730eb0 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/CatalogInventory/Section/InventorySection.xml @@ -0,0 +1,15 @@ + + + +
+ + + + +
+
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutCartProductSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutCartProductSection.xml index 6e4f52f689eb4..92c10ca83a76d 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutCartProductSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/CheckoutCartProductSection.xml @@ -24,5 +24,7 @@ +
diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/StoreFrontRemoveItemModalSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/StoreFrontRemoveItemModalSection.xml new file mode 100644 index 0000000000000..e6d994fb587b0 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/StoreFrontRemoveItemModalSection.xml @@ -0,0 +1,16 @@ + + + + +
+ + + +
+
\ No newline at end of file diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/StorefrontMiniCartSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/StorefrontMiniCartSection.xml index 8f21770491f58..bdd97130a9715 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/StorefrontMiniCartSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Section/StorefrontMiniCartSection.xml @@ -22,5 +22,6 @@ + diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Test/NoErrorCartCheckoutForProductsDeletedFromMiniCartTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Test/NoErrorCartCheckoutForProductsDeletedFromMiniCartTest.xml new file mode 100644 index 0000000000000..ac29f8aa0bcc9 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Checkout/Test/NoErrorCartCheckoutForProductsDeletedFromMiniCartTest.xml @@ -0,0 +1,54 @@ + + + + + + + + + + <description value="No error from cart should be thrown for product deleted from minicart"/> + <severity value="CRITICAL"/> + <testCaseId value="MAGETWO-91451"/> + <group value="checkout"/> + </annotations> + <!-- Preconditions --> + <before> + <!-- Simple product is created with price = 100 --> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="_defaultProduct" stepKey="createSimpleProduct"> + <field key="price">100.00</field> + <requiredEntity createDataKey="createCategory"/> + </createData> + </before> + <after> + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + </after> + <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onStorefrontCategoryPage"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/> + <click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addProductToCart"/> + <waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/> + <see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added $$createSimpleProduct.name$$ to your shopping cart." stepKey="seeAddedToCartMessage"/> + <see selector="{{StorefrontMinicartSection.quantity}}" userInput="1" stepKey="seeCartQuantity"/> + <!-- open the minicart --> + <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickShowMinicart1"/> + <click selector="{{StorefrontMinicartSection.viewAndEditCart}}" stepKey="editProductFromMiniCart"/> + <click selector="{{StorefrontMinicartSection.showCart}}" stepKey="clickShowMinicart2"/> + <click selector="{{StorefrontMinicartSection.deleteMiniCartItem}}" stepKey="deleteMiniCartItem"/> + <waitForElementVisible selector="{{StoreFrontRemoveItemModalSection.message}}" stepKey="waitFortheConfirmationModal"/> + <see selector="{{StoreFrontRemoveItemModalSection.message}}" userInput="Are you sure you would like to remove this item from the shopping cart?" stepKey="seeDeleteConfirmationMessage"/> + <click selector="{{StoreFrontRemoveItemModalSection.ok}}" stepKey="confirmDelete"/> + <waitForPageLoad stepKey="waitForDeleteToFinish"/> + <click selector="{{CheckoutCartProductSection.RemoveItem}}" stepKey="deleteProductFromCheckoutCart"/> + <waitForPageLoad stepKey="WaitForPageLoad3"/> + <see userInput="You have no items in your shopping cart." stepKey="seeNoItemsInShoppingCart"/> + </test> +</tests> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageActionsSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageActionsSection.xml index 3ceef6d422782..64ee4262a51dd 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageActionsSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/CmsNewPagePageActionsSection.xml @@ -7,7 +7,7 @@ --> <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> <section name="CmsNewPagePageActionsSection"> <element name="savePage" type="button" selector="#save_and_close" timeout="10"/> <element name="reset" type="button" selector="#reset"/> @@ -16,7 +16,7 @@ <element name="splitButtonMenu" type="button" selector="//ul[@data-ui-id='save-button-dropdown-menu']" timeout="10"/> <element name="expandSplitButton" type="button" selector="//button[@data-ui-id='save-button-dropdown']" timeout="10"/> <element name="cmsPageTitle" type="text" selector=".page-header .page-title"/> - <element name="pageTitle" type="input" selector="//*[@name='title']"/> + <element name="pageTitle" type="input" selector="input[name='title']"/> <element name="showHideEditor" type="button" selector="//*[@id='togglecms_page_form_content']"/> <element name="contentSectionName" type="input" selector="//div[@class='fieldset-wrapper-title']//span[.='Content']"/> <element name="content" type="input" selector="//textarea[@name='content']"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/TinyMCESection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/TinyMCESection.xml index ed6b1dd0284f3..a158d1ed8580b 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/TinyMCESection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Section/TinyMCESection.xml @@ -12,7 +12,6 @@ <element name="checkIfContentTabOpen" type="button" selector="//span[text()='Content']/parent::strong/parent::*[@data-state-collapsible='closed']"/> <element name="CheckIfTabExpand" type="button" selector="//div[@data-state-collapsible='closed']//span[text()='Content']"/> <element name="TinyMCE4" type="text" selector=".mce-branding-powered-by" /> - <element name="TinyMCE3" type="text" selector="#cms_page_form_content_tbl"/> <element name="InsertWidgetBtn" type="button" selector=".action-add-widget"/> <element name="InsertWidgetIcon" type="button" selector="div[aria-label='Insert Widget']"/> <element name="InsertVariableBtn" type="button" selector=".scalable.add-variable.plugin"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Section/NewsletterTemplateSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Section/NewsletterTemplateSection.xml index 9f272d34a100a..e3be7570f87d4 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Section/NewsletterTemplateSection.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Newsletter/Section/NewsletterTemplateSection.xml @@ -19,7 +19,6 @@ <section name="NewsletterWYSIWYGSection"> <element name="TextArea" type="text" selector="#text" /> <element name="TinyMCE4" type="text" selector=".mce-branding-powered-by" /> - <element name="TinyMCE3" type="text" selector="#cms_page_form_content_tbl"/> <element name="ShowHideBtn" type="button" selector="#toggletext"/> <element name="InsertWidgetBtn" type="button" selector=".action-add-widget"/> <element name="InsertWidgetIcon" type="button" selector="div[aria-label='Insert Widget']"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/CreateCustomStoreViewActionGroup.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/CreateCustomStoreViewActionGroup.xml index 80c442d2e13b9..7315a4fcde06f 100644 --- a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/CreateCustomStoreViewActionGroup.xml +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Store/ActionGroup/CreateCustomStoreViewActionGroup.xml @@ -11,8 +11,7 @@ <arguments> <argument name="storeGroupName" defaultValue="customStoreGroup.name"/> </arguments> - <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> - <click selector="{{AdminStoresMainActionsSection.createStoreViewButton}}" stepKey="clickCreateStoreViewButton"/> + <amOnPage url="{{AdminSystemStoreViewPage.url}}" stepKey="amOnAdminSystemStoreViewPage"/> <waitForPageLoad time="30" stepKey="waitForProductPageLoad"/> <selectOption userInput="{{storeGroupName}}" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/> <fillField userInput="{{customStore.name}}" selector="{{AdminNewStoreSection.storeNameTextField}}" stepKey="fillStoreViewName"/> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Tinymce3/LICENSE.txt b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Tinymce3/LICENSE.txt new file mode 100644 index 0000000000000..49525fd99da9c --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Tinymce3/LICENSE.txt @@ -0,0 +1,48 @@ + +Open Software License ("OSL") v. 3.0 + +This Open Software License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work: + +Licensed under the Open Software License version 3.0 + + 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following: + + 1. to reproduce the Original Work in copies, either alone or as part of a collective work; + + 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work; + + 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, with the proviso that copies of Original Work or Derivative Works that You distribute or communicate shall be licensed under this Open Software License; + + 4. to perform the Original Work publicly; and + + 5. to display the Original Work publicly. + + 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works. + + 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work. + + 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license. + + 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c). + + 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work. + + 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer. + + 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation. + + 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including 'fair use' or 'fair dealing'). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c). + + 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware. + + 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License. + + 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License. + + 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. + + 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + + 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You. + + 16. Modification of This License. This License is Copyright (C) 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Open Software License" or "OSL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process. \ No newline at end of file diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Tinymce3/LICENSE_AFL.txt b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Tinymce3/LICENSE_AFL.txt new file mode 100644 index 0000000000000..f39d641b18a19 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Tinymce3/LICENSE_AFL.txt @@ -0,0 +1,48 @@ + +Academic Free License ("AFL") v. 3.0 + +This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work: + +Licensed under the Academic Free License version 3.0 + + 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following: + + 1. to reproduce the Original Work in copies, either alone or as part of a collective work; + + 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work; + + 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License; + + 4. to perform the Original Work publicly; and + + 5. to display the Original Work publicly. + + 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works. + + 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work. + + 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license. + + 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c). + + 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work. + + 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer. + + 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation. + + 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c). + + 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware. + + 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License. + + 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License. + + 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. + + 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + + 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You. + + 16. Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process. diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Tinymce3/README.md b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Tinymce3/README.md new file mode 100644 index 0000000000000..a9412ea9d26b8 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Tinymce3/README.md @@ -0,0 +1,3 @@ +# Magento 2 Functional Tests + +The Functional Tests Module for **Magento_Tinemce3** Module. diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Tinymce3/Section/AdminTinymce3FileldsSection.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Tinymce3/Section/AdminTinymce3FileldsSection.xml new file mode 100644 index 0000000000000..1c666a9755420 --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Tinymce3/Section/AdminTinymce3FileldsSection.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd"> + <section name="ProductWYSIWYGSection"> + <element name="Tinymce3MSG" type="button" selector=".admin__field-error"/> + </section> + <section name="TinyMCESection"> + <element name="TinyMCE3" type="text" selector="#cms_page_form_content_tbl"/> + </section> + <section name="NewsletterWYSIWYGSection"> + <element name="TinyMCE3" type="text" selector="#cms_page_form_content_tbl"/> + </section> +</sections> diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsTest.xml b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Tinymce3/Test/AdminSwitchWYSIWYGOptionsTest.xml similarity index 100% rename from dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Cms/Test/AdminSwitchWYSIWYGOptionsTest.xml rename to dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Tinymce3/Test/AdminSwitchWYSIWYGOptionsTest.xml diff --git a/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Tinymce3/composer.json b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Tinymce3/composer.json new file mode 100644 index 0000000000000..7bccbdd2b1b3d --- /dev/null +++ b/dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Tinymce3/composer.json @@ -0,0 +1,35 @@ +{ + "name": "magento/magento2-functional-test-module-tinymce-3", + "description": "Magento 2 Functional Test Module Theme", + "type": "magento2-test-module", + "version": "100.0.0-dev", + "license": [ + "OSL-3.0", + "AFL-3.0" + ], + "config": { + "sort-packages": true + }, + "require": { + "magento/magento2-functional-testing-framework": "~2.0.0", + "php": "~7.1.3||~7.2.0" + }, + "suggest": { + "magento/magento2-functional-test-module-ui": "100.0.0-dev", + "magento/magento2-functional-test-module-variable": "100.0.0-dev", + "magento/magento2-functional-test-module-widget": "100.0.0-dev" + }, + "autoload": { + "psr-4": { + "Magento\\FunctionalTest\\Theme\\": "" + } + }, + "extra": { + "map": [ + [ + "*", + "tests/functional/Magento/FunctionalTest/Theme" + ] + ] + } +} diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php index b95e0f933ea04..65e044a5f005b 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchTest.php @@ -512,6 +512,15 @@ public function testQueryProductsInCurrentPageSortedByPriceASC() page_size current_page } + sort_fields + { + default + options + { + value + label + } + } } } QUERY; @@ -530,6 +539,13 @@ public function testQueryProductsInCurrentPageSortedByPriceASC() $this->assertProductItems($filteredChildProducts, $response); $this->assertEquals(4, $response['products']['page_info']['page_size']); $this->assertEquals(1, $response['products']['page_info']['current_page']); + $this->assertArrayHasKey('sort_fields', $response['products']); + $this->assertArrayHasKey('options', $response['products']['sort_fields']); + $this->assertArrayHasKey('default', $response['products']['sort_fields']); + $this->assertEquals('position', $response['products']['sort_fields']['default']); + $this->assertArrayHasKey('value', $response['products']['sort_fields']['options'][0]); + $this->assertArrayHasKey('label', $response['products']['sort_fields']['options'][0]); + $this->assertEquals('position', $response['products']['sort_fields']['options'][0]['value']); } /** diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php index a4c7f41df0e99..aaf22c8b373fe 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php @@ -227,6 +227,7 @@ public function testQueryAllFieldsSimpleProduct() updated_at url_key url_path + canonical_url websites { id name code sort_order default_group_id is_default } ... on PhysicalProductInterface { weight @@ -272,6 +273,11 @@ public function testQueryAllFieldsSimpleProduct() 'Filter category', $responseObject->getData('products/items/0/categories/2/name') ); + $storeManager = ObjectManager::getInstance()->get(\Magento\Store\Model\StoreManagerInterface::class); + self::assertEquals( + $storeManager->getStore()->getBaseUrl() . 'simple-product.html', + $responseObject->getData('products/items/0/canonical_url') + ); } /** diff --git a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/ReorderUsingVaultTest.xml b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/ReorderUsingVaultTest.xml index bea169dc64ad3..7f15a6ba03f15 100644 --- a/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/ReorderUsingVaultTest.xml +++ b/dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/ReorderUsingVaultTest.xml @@ -26,7 +26,7 @@ <data name="creditCard/data/payment_code" xsi:type="string">braintree</data> <data name="configData" xsi:type="string">braintree, braintree_use_vault</data> <data name="status" xsi:type="string">Processing</data> - <data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S1</data> + <data name="tag" xsi:type="string">severity:S1</data> <constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" /> <constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" /> <constraint name="Magento\Sales\Test\Constraint\AssertAuthorizationInCommentsHistory" /> diff --git a/dev/tests/integration/_files/Magento/TestModuleWysiwygConfig/Model/Config.php b/dev/tests/integration/_files/Magento/TestModuleWysiwygConfig/Model/Config.php index b74c30c6eef65..7726782c49f08 100644 --- a/dev/tests/integration/_files/Magento/TestModuleWysiwygConfig/Model/Config.php +++ b/dev/tests/integration/_files/Magento/TestModuleWysiwygConfig/Model/Config.php @@ -22,11 +22,14 @@ class Config implements \Magento\Framework\Data\Wysiwyg\ConfigProviderInterface /** * @inheritdoc */ - public function getConfig($config) + public function getConfig(\Magento\Framework\DataObject $config): \Magento\Framework\DataObject { - $config['height'] = self::CONFIG_HEIGHT; - $config['content_css'] = self::CONFIG_CONTENT_CSS; - + $config->addData( + [ + 'height' => self::CONFIG_HEIGHT, + 'content_css' => self::CONFIG_CONTENT_CSS + ] + ); return $config; } } diff --git a/dev/tests/integration/_files/Magento/TestModuleWysiwygConfig/etc/di.xml b/dev/tests/integration/_files/Magento/TestModuleWysiwygConfig/etc/di.xml new file mode 100644 index 0000000000000..cd9710db45b45 --- /dev/null +++ b/dev/tests/integration/_files/Magento/TestModuleWysiwygConfig/etc/di.xml @@ -0,0 +1,16 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> + <type name="Magento\Ui\Block\Wysiwyg\ActiveEditor"> + <arguments> + <argument name="availableAdapterPaths" xsi:type="array"> + <item name="testAdapter" xsi:type="string"/> + </argument> + </arguments> + </type> +</config> diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Rule/view/adminhtml/web/conditions-data-normalizer.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Rule/view/adminhtml/web/conditions-data-normalizer.test.js new file mode 100644 index 0000000000000..21c04d098ae6c --- /dev/null +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Rule/view/adminhtml/web/conditions-data-normalizer.test.js @@ -0,0 +1,69 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'jquery', + 'Magento_Rule/conditions-data-normalizer' +], function ($, Normalizer) { + 'use strict'; + + describe('Magento_Rule/conditions-data-normalizer', function () { + var normalizer; + + beforeEach(function () { + normalizer = new Normalizer(); + }); + + it('Check for empty object when input is a falsey value', function () { + expect(normalizer.normalize('')).toEqual({}); + expect(normalizer.normalize()).toEqual({}); + expect(normalizer.normalize(false)).toEqual({}); + expect(normalizer.normalize(null)).toEqual({}); + expect(normalizer.normalize(0)).toEqual({}); + }); + + it('Check single level normalization.', function () { + var normal = normalizer.normalize({ + foo: 'bar', + bar: 123 + }); + + expect(normal.foo).toEqual('bar'); + expect(normal.bar).toEqual(123); + }); + + it('Check one sub-level of normalization.', function () { + var normal = normalizer.normalize({ + 'foo[value]': 'bar', + 'foo[name]': 123 + }); + + expect(normal.foo.value).toEqual('bar'); + expect(normal.foo.name).toEqual(123); + }); + + it('Check two sub-levels of normalization.', function () { + var normal = normalizer.normalize({ + 'foo[prefix][value]': 'bar', + 'foo[prefix][name]': 123 + }); + + expect(normal.foo.prefix.value).toEqual('bar'); + expect(normal.foo.prefix.name).toEqual(123); + }); + + it('Check that numeric types don\'t get converted to array form.', function () { + var normal = normalizer.normalize({ + 'foo[1][name]': 'bar', + 'foo[1][value]': 123, + 'foo[1--1]': 321 + }); + + expect(normal.foo['1'].name).toEqual('bar'); + expect(normal.foo['1'].value).toEqual(123); + expect(normal.foo['1--1']).toEqual(321); + }); + }); +}); diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/url-input.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/url-input.test.js index c0f55168a5496..533faa7c2eef0 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/url-input.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/element/url-input.test.js @@ -72,5 +72,45 @@ define([ }); }); + describe('Parent config properties are propagated', function () { + it('sets the disabled property on the child element', function () { + var params = { + dataScope: 'urlInput', + disabled: true, + urlTypes: { + url: { + label: 'Test label', + component: 'Magento_Ui/js/form/element/abstract', + template: 'ui/form/element/input', + sortOrder: 40 + } + } + }; + + component = new UrlInput(params); + expect(component.disabled()).toBe(true); + expect(component.urlTypes.url.disabled).toBe(true); + }); + + it('sets the visible property on the child element', function () { + var params = { + dataScope: 'urlInput', + visible: false, + urlTypes: { + url: { + label: 'Test label', + component: 'Magento_Ui/js/form/element/abstract', + template: 'ui/form/element/input', + sortOrder: 40 + } + } + }; + + component = new UrlInput(params); + expect(component.visible()).toBe(false); + expect(component.urlTypes.url.visible).toBe(false); + }); + }); + }); }); diff --git a/lib/internal/Magento/Framework/App/Request/Http.php b/lib/internal/Magento/Framework/App/Request/Http.php index 5d4ca42d66cbe..4421903f40c2e 100644 --- a/lib/internal/Magento/Framework/App/Request/Http.php +++ b/lib/internal/Magento/Framework/App/Request/Http.php @@ -149,7 +149,7 @@ public function setPathInfo($pathInfo = null) return $this; } - $requestUri = $this->removeRepitedSlashes($requestUri); + $requestUri = $this->removeRepeatedSlashes($requestUri); $parsedRequestUri = explode('?', $requestUri, 2); $queryString = !isset($parsedRequestUri[1]) ? '' : '?' . $parsedRequestUri[1]; $baseUrl = $this->getBaseUrl(); @@ -172,7 +172,7 @@ public function setPathInfo($pathInfo = null) * @param string $pathInfo * @return string */ - private function removeRepitedSlashes($pathInfo) + private function removeRepeatedSlashes($pathInfo) { $firstChar = (string)substr($pathInfo, 0, 1); if ($firstChar == '/') { diff --git a/lib/internal/Magento/Framework/Data/Wysiwyg/ConfigProviderInterface.php b/lib/internal/Magento/Framework/Data/Wysiwyg/ConfigProviderInterface.php index dca806678dcb2..dc1dabd42d9e8 100644 --- a/lib/internal/Magento/Framework/Data/Wysiwyg/ConfigProviderInterface.php +++ b/lib/internal/Magento/Framework/Data/Wysiwyg/ConfigProviderInterface.php @@ -3,10 +3,13 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Framework\Data\Wysiwyg; /** * Interface ConfigProviderInterface + * @api */ interface ConfigProviderInterface { @@ -14,5 +17,5 @@ interface ConfigProviderInterface * @param \Magento\Framework\DataObject $config * @return \Magento\Framework\DataObject */ - public function getConfig($config); + public function getConfig(\Magento\Framework\DataObject $config) : \Magento\Framework\DataObject; } diff --git a/lib/internal/Magento/Framework/View/Page/Config.php b/lib/internal/Magento/Framework/View/Page/Config.php index 4b081daea83aa..d42d30e35cc5b 100644 --- a/lib/internal/Magento/Framework/View/Page/Config.php +++ b/lib/internal/Magento/Framework/View/Page/Config.php @@ -117,6 +117,7 @@ class Config 'description' => null, 'keywords' => null, 'robots' => null, + 'title' => null, ]; /** diff --git a/lib/internal/Magento/Framework/View/Page/Config/Renderer.php b/lib/internal/Magento/Framework/View/Page/Config/Renderer.php index 9563cbfbcc532..93c8c5c338627 100644 --- a/lib/internal/Magento/Framework/View/Page/Config/Renderer.php +++ b/lib/internal/Magento/Framework/View/Page/Config/Renderer.php @@ -136,6 +136,12 @@ public function renderMetadata() protected function processMetadataContent($name, $content) { $method = 'get' . $this->string->upperCaseWords($name, '_', ''); + if ($name === 'title') { + if (!$content) { + $content = $this->escaper->escapeHtml($this->pageConfig->$method()->get()); + } + return $content; + } if (method_exists($this->pageConfig, $method)) { $content = $this->pageConfig->$method(); } diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Page/ConfigTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Page/ConfigTest.php index d979f66e5adf1..0307821f92cce 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Page/ConfigTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Page/ConfigTest.php @@ -13,7 +13,7 @@ use Magento\Framework\View\Page\Config; /** - * @covers Magento\Framework\View\Page\Config + * @covers \Magento\Framework\View\Page\Config * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -139,6 +139,7 @@ public function testMetadata() 'description' => null, 'keywords' => null, 'robots' => null, + 'title' => null, 'name' => 'test_value', 'html_encoded' => '<title><span class="test">Test</span></title>', ]; diff --git a/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php b/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php index bcbecd37d90df..26102f008c7c3 100644 --- a/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php +++ b/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php @@ -5,15 +5,16 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Framework\Webapi; -use Magento\Framework\Webapi\ServiceTypeToEntityTypeMap; use Magento\Framework\Api\AttributeValue; use Magento\Framework\Api\AttributeValueFactory; use Magento\Framework\Api\SimpleDataObjectConverter; use Magento\Framework\Exception\InputException; use Magento\Framework\Exception\SerializationException; +use Magento\Framework\ObjectManager\ConfigInterface; use Magento\Framework\ObjectManagerInterface; use Magento\Framework\Phrase; use Magento\Framework\Reflection\MethodsMap; @@ -66,6 +67,11 @@ class ServiceInputProcessor implements ServicePayloadConverterInterface */ private $serviceTypeToEntityTypeMap; + /** + * @var ConfigInterface + */ + private $config; + /** * Initialize dependencies. * @@ -75,6 +81,7 @@ class ServiceInputProcessor implements ServicePayloadConverterInterface * @param CustomAttributeTypeLocatorInterface $customAttributeTypeLocator * @param MethodsMap $methodsMap * @param ServiceTypeToEntityTypeMap $serviceTypeToEntityTypeMap + * @param ConfigInterface $config */ public function __construct( TypeProcessor $typeProcessor, @@ -82,7 +89,8 @@ public function __construct( AttributeValueFactory $attributeValueFactory, CustomAttributeTypeLocatorInterface $customAttributeTypeLocator, MethodsMap $methodsMap, - ServiceTypeToEntityTypeMap $serviceTypeToEntityTypeMap = null + ServiceTypeToEntityTypeMap $serviceTypeToEntityTypeMap = null, + ConfigInterface $config = null ) { $this->typeProcessor = $typeProcessor; $this->objectManager = $objectManager; @@ -91,6 +99,8 @@ public function __construct( $this->methodsMap = $methodsMap; $this->serviceTypeToEntityTypeMap = $serviceTypeToEntityTypeMap ?: \Magento\Framework\App\ObjectManager::getInstance()->get(ServiceTypeToEntityTypeMap::class); + $this->config = $config + ?: \Magento\Framework\App\ObjectManager::getInstance()->get(ConfigInterface::class); } /** @@ -154,6 +164,33 @@ public function process($serviceClassName, $serviceMethodName, array $inputArray return $inputData; } + /** + * @param string $className + * @param array $data + * @return array + * @throws \ReflectionException + */ + private function getConstructorData(string $className, array $data): array + { + $preferenceClass = $this->config->getPreference($className); + $class = new ClassReflection($preferenceClass ?: $className); + + $constructor = $class->getConstructor(); + if ($constructor === null) { + return []; + } + + $res = []; + $parameters = $constructor->getParameters(); + foreach ($parameters as $parameter) { + if (isset($data[$parameter->getName()])) { + $res[$parameter->getName()] = $data[$parameter->getName()]; + } + } + + return $res; + } + /** * Creates a new instance of the given class and populates it with the array of data. The data can * be in different forms depending on the adapter being used, REST vs. SOAP. For REST, the data is @@ -163,6 +200,7 @@ public function process($serviceClassName, $serviceMethodName, array $inputArray * @param array $data * @return object the newly created and populated object * @throws \Exception + * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ protected function _createFromArray($className, $data) { @@ -174,9 +212,17 @@ protected function _createFromArray($className, $data) if (is_subclass_of($className, self::EXTENSION_ATTRIBUTES_TYPE)) { $className = substr($className, 0, -strlen('Interface')); } - $object = $this->objectManager->create($className); + // Primary method: assign to constructor parameters + $constructorArgs = $this->getConstructorData($className, $data); + $object = $this->objectManager->create($className, $constructorArgs); + + // Secondary method: fallback to setter methods foreach ($data as $propertyName => $value) { + if (isset($constructorArgs[$propertyName])) { + continue; + } + // Converts snake_case to uppercase CamelCase to help form getter/setter method names // This use case is for REST only. SOAP request data is already camel cased $camelCaseProperty = SimpleDataObjectConverter::snakeCaseToUpperCamelCase($propertyName); diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/SimpleConstructor.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/SimpleConstructor.php new file mode 100644 index 0000000000000..f457a96e22a37 --- /dev/null +++ b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/SimpleConstructor.php @@ -0,0 +1,45 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor; + +class SimpleConstructor +{ + /** + * @var int + */ + private $entityId; + + /** + * @var string + */ + private $name; + + public function __construct( + int $entityId, + string $name + ) { + $this->entityId = $entityId; + $this->name = $name; + } + + /** + * @return int|null + */ + public function getEntityId() + { + return $this->entityId; + } + + /** + * @return string|null + */ + public function getName() + { + return $this->name; + } +} diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/TestService.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/TestService.php index a5f91c101aa56..34515e8460b57 100644 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/TestService.php +++ b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessor/TestService.php @@ -5,11 +5,6 @@ */ namespace Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor; -use Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\AssociativeArray; -use Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\DataArray; -use Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Nested; -use Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\SimpleArray; - class TestService { const DEFAULT_VALUE = 42; @@ -25,6 +20,15 @@ public function simple($entityId, $name) return [$entityId, $name]; } + /** + * @param \Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\SimpleConstructor $simpleConstructor + * @return \Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\SimpleConstructor + */ + public function simpleConstructor(SimpleConstructor $simpleConstructor) + { + return $simpleConstructor; + } + /** * @param int $entityId * @return string[] @@ -34,6 +38,15 @@ public function simpleDefaultValue($entityId = self::DEFAULT_VALUE) return [$entityId]; } + /** + * @param int $entityId + * @return string[] + */ + public function constructorArguments($entityId = self::DEFAULT_VALUE) + { + return [$entityId]; + } + /** * @param \Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Nested $nested * @return \Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\Nested diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php index a4c3f00e374a8..3393b325a8f16 100644 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php +++ b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php @@ -9,6 +9,7 @@ use Magento\Framework\Serialize\SerializerInterface; use Magento\Framework\Webapi\ServiceInputProcessor; use Magento\Framework\Webapi\ServiceTypeToEntityTypeMap; +use Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\SimpleConstructor; use Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\WebapiBuilderFactory; use Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\AssociativeArray; use Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\DataArray; @@ -59,8 +60,8 @@ protected function setUp() $this->objectManagerMock->expects($this->any()) ->method('create') ->willReturnCallback( - function ($className) use ($objectManager) { - return $objectManager->getObject($className); + function ($className, $arguments = []) use ($objectManager) { + return $objectManager->getObject($className, $arguments); } ); @@ -202,6 +203,22 @@ public function testNestedDataProperties() $this->assertEquals('Test', $details->getName()); } + public function testSimpleConstructorProperties() + { + $data = ['simpleConstructor' => ['entityId' => 15, 'name' => 'Test']]; + $result = $this->serviceInputProcessor->process( + \Magento\Framework\Webapi\Test\Unit\ServiceInputProcessor\TestService::class, + 'simpleConstructor', + $data + ); + $this->assertNotNull($result); + $arg = $result[0]; + + $this->assertTrue($arg instanceof SimpleConstructor); + $this->assertEquals(15, $arg->getEntityId()); + $this->assertEquals('Test', $arg->getName()); + } + public function testSimpleArrayProperties() { $data = ['ids' => [1, 2, 3, 4]];