Skip to content

Commit dea360c

Browse files
author
Oleksandr Iegorov
committed
Merge branch '2.2-develop' of github.com:magento/magento2ce into PR-2.2-1
2 parents 3b04db1 + a2130b2 commit dea360c

File tree

55 files changed

+1034
-122
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1034
-122
lines changed

app/code/Magento/Analytics/etc/adminhtml/system.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
<source_model>Magento\Analytics\Model\Config\Source\Vertical</source_model>
3737
<backend_model>Magento\Analytics\Model\Config\Backend\Vertical</backend_model>
3838
<frontend_model>Magento\Analytics\Block\Adminhtml\System\Config\Vertical</frontend_model>
39+
<depends>
40+
<field id="analytics/general/enabled">1</field>
41+
</depends>
3942
</field>
4043
<field id="additional_comment" translate="label comment" type="label" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0">
4144
<label><![CDATA[<strong>Get more insights from Magento Business Intelligence</strong>]]></label>

app/code/Magento/Backend/Model/Config/SessionLifetime/BackendModel.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,17 @@
1515
*/
1616
class BackendModel extends Value
1717
{
18-
/** Maximum dmin session lifetime; 1 year*/
18+
/** Maximum admin session lifetime; 1 year*/
1919
const MAX_LIFETIME = 31536000;
2020

2121
/** Minimum admin session lifetime */
2222
const MIN_LIFETIME = 60;
2323

2424
/**
25+
* Processing object before save data
26+
*
2527
* @since 100.1.0
28+
* @throws LocalizedException
2629
*/
2730
public function beforeSave()
2831
{
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Backend\Test\Unit\Service\V1;
9+
10+
use Magento\Backend\Service\V1\ModuleService;
11+
use Magento\Framework\Module\ModuleListInterface;
12+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
13+
14+
/**
15+
* Module List Service Test
16+
*
17+
* Covers \Magento\Sales\Model\ValidatorResultMerger
18+
*/
19+
class ModuleServiceTest extends \PHPUnit\Framework\TestCase
20+
{
21+
/**
22+
* Testable Object
23+
*
24+
* @var ModuleService
25+
*/
26+
private $moduleService;
27+
28+
/**
29+
* @var ModuleListInterface|\PHPUnit_Framework_MockObject_MockObject
30+
*/
31+
private $moduleListMock;
32+
33+
/**
34+
* Object Manager
35+
*
36+
* @var ObjectManager
37+
*/
38+
private $objectManager;
39+
40+
/**
41+
* Set Up
42+
*
43+
* @return void
44+
*/
45+
protected function setUp()
46+
{
47+
$this->moduleListMock = $this->createMock(ModuleListInterface::class);
48+
$this->objectManager = new ObjectManager($this);
49+
$this->moduleService = $this->objectManager->getObject(
50+
ModuleService::class,
51+
[
52+
'moduleList' => $this->moduleListMock,
53+
]
54+
);
55+
}
56+
57+
/**
58+
* Test getModules method
59+
*
60+
* @return void
61+
*/
62+
public function testGetModules()
63+
{
64+
$moduleNames = ['Magento_Backend', 'Magento_Catalog', 'Magento_Customer'];
65+
$this->moduleListMock->expects($this->once())->method('getNames')->willReturn($moduleNames);
66+
67+
$expected = $moduleNames;
68+
$actual = $this->moduleService->getModules();
69+
$this->assertEquals($expected, $actual);
70+
}
71+
}

app/code/Magento/Braintree/Model/Ui/PayPal/ConfigProvider.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,14 @@ public function __construct(Config $config, ResolverInterface $resolver)
4141
}
4242

4343
/**
44-
* Retrieve assoc array of checkout configuration
44+
* Retrieve assoc array of checkout configuration.
4545
*
4646
* @return array
4747
*/
48-
public function getConfig()
48+
public function getConfig(): array
4949
{
50+
$requireBillingAddressAll = \Magento\Paypal\Model\Config::REQUIRE_BILLING_ADDRESS_ALL;
51+
5052
return [
5153
'payment' => [
5254
self::PAYPAL_CODE => [
@@ -60,6 +62,8 @@ public function getConfig()
6062
'vaultCode' => self::PAYPAL_VAULT_CODE,
6163
'skipOrderReview' => $this->config->isSkipOrderReview(),
6264
'paymentIcon' => $this->config->getPayPalIcon(),
65+
'isRequiredBillingAddress' =>
66+
(int)$this->config->isRequiredBillingAddress() === $requireBillingAddressAll,
6367
]
6468
]
6569
];

app/code/Magento/Braintree/Test/Unit/Model/Ui/PayPal/ConfigProviderTest.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ protected function setUp()
4747
}
4848

4949
/**
50-
* Run test getConfig method
50+
* Run test getConfig method.
5151
*
5252
* @param array $expected
53+
* @return void
5354
* @dataProvider getConfigDataProvider
5455
*/
5556
public function testGetConfig($expected)
@@ -77,13 +78,16 @@ public function testGetConfig($expected)
7778
'width' => 30, 'height' => 26, 'url' => 'https://icon.test.url'
7879
]);
7980

81+
$this->config->method('isRequiredBillingAddress')
82+
->willReturn(1);
83+
8084
self::assertEquals($expected, $this->configProvider->getConfig());
8185
}
8286

8387
/**
8488
* @return array
8589
*/
86-
public function getConfigDataProvider()
90+
public function getConfigDataProvider(): array
8791
{
8892
return [
8993
[
@@ -101,7 +105,8 @@ public function getConfigDataProvider()
101105
'skipOrderReview' => false,
102106
'paymentIcon' => [
103107
'width' => 30, 'height' => 26, 'url' => 'https://icon.test.url'
104-
]
108+
],
109+
'isRequiredBillingAddress' => true,
105110
]
106111
]
107112
]

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ define([
206206
beforePlaceOrder: function (data) {
207207
this.setPaymentMethodNonce(data.nonce);
208208

209-
if (quote.billingAddress() === null && typeof data.details.billingAddress !== 'undefined') {
209+
if ((this.isRequiredBillingAddress() || quote.billingAddress() === null) &&
210+
typeof data.details.billingAddress !== 'undefined'
211+
) {
210212
this.setBillingAddress(data.details, data.details.billingAddress);
211213
}
212214

@@ -264,6 +266,14 @@ define([
264266
return window.checkoutConfig.payment[this.getCode()].isAllowShippingAddressOverride;
265267
},
266268

269+
/**
270+
* Is billing address required from PayPal side.
271+
* @returns {Boolean}
272+
*/
273+
isRequiredBillingAddress: function () {
274+
return window.checkoutConfig.payment[this.getCode()].isRequiredBillingAddress;
275+
},
276+
267277
/**
268278
* Get configuration for PayPal
269279
* @returns {Object}

app/code/Magento/Catalog/Model/Product.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ public function setQty($qty)
985985
*/
986986
public function getQty()
987987
{
988-
return $this->getData('qty');
988+
return (float)$this->getData('qty');
989989
}
990990

991991
/**

app/code/Magento/Catalog/Model/Product/Gallery/UpdateHandler.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
class UpdateHandler extends \Magento\Catalog\Model\Product\Gallery\CreateHandler
1717
{
1818
/**
19-
* {@inheritdoc}
19+
* @inheritdoc
20+
*
2021
* @since 101.0.0
2122
*/
2223
protected function processDeletedImages($product, array &$images)
@@ -31,7 +32,7 @@ protected function processDeletedImages($product, array &$images)
3132

3233
foreach ($images as &$image) {
3334
if (!empty($image['removed'])) {
34-
if (!empty($image['value_id']) && !isset($picturesInOtherStores[$image['file']])) {
35+
if (!empty($image['value_id'])) {
3536
if (preg_match('/\.\.(\\\|\/)/', $image['file'])) {
3637
continue;
3738
}
@@ -52,7 +53,8 @@ protected function processDeletedImages($product, array &$images)
5253
}
5354

5455
/**
55-
* {@inheritdoc}
56+
* @inheritdoc
57+
*
5658
* @since 101.0.0
5759
*/
5860
protected function processNewImage($product, array &$image)
@@ -79,6 +81,8 @@ protected function processNewImage($product, array &$image)
7981
}
8082

8183
/**
84+
* Retrieve store ids from product.
85+
*
8286
* @param \Magento\Catalog\Model\Product $product
8387
* @return array
8488
* @since 101.0.0
@@ -97,6 +101,8 @@ protected function extractStoreIds($product)
97101
}
98102

99103
/**
104+
* Remove deleted images.
105+
*
100106
* @param array $files
101107
* @return null
102108
* @since 101.0.0

app/code/Magento/Catalog/Pricing/Price/BasePrice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function getValue()
3030
$this->value = false;
3131
foreach ($this->priceInfo->getPrices() as $price) {
3232
if ($price instanceof BasePriceProviderInterface && $price->getValue() !== false) {
33-
$this->value = min($price->getValue(), $this->value ?: $price->getValue());
33+
$this->value = min($price->getValue(), $this->value !== false ? $this->value: $price->getValue());
3434
}
3535
}
3636
}

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryProductAttributeActionGroup.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,17 @@
2525
<waitForElementVisible selector="{{AdminConfirmationModalSection.message}}" stepKey="waitingForWarningModal"/>
2626
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmStoreDelete"/>
2727
</actionGroup>
28+
29+
<actionGroup name="navigateToProductAttribute">
30+
<arguments>
31+
<argument name="attributeCode" type="string"/>
32+
</arguments>
33+
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/>
34+
<waitForPageLoad stepKey="waitForAttributeGridPageLoad"/>
35+
<conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingFilters"/>
36+
<fillField selector="{{AdminProductAttributeGridSection.filterByAttributeCode}}" userInput="{{attributeCode}}" stepKey="fillAttributeCodeFilter"/>
37+
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFiltersButton"/>
38+
<click selector="{{AdminProductAttributeGridSection.attributeCode(attributeCode)}}" stepKey="navigateToAttributeEditPage" />
39+
<waitForPageLoad stepKey="waitForAttributeEditPageLoad" />
40+
</actionGroup>
2841
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
<waitForElementNotVisible selector="{{AdminProductFormAdvancedPricingSection.specialPrice}}" stepKey="waitForCloseModalWindow"/>
9292
</actionGroup>
9393

94+
<!--Set product to website-->
9495
<actionGroup name="ProductSetWebsite">
9596
<arguments>
9697
<argument name="website"/>
@@ -131,12 +132,12 @@
131132
<!--Switch to New Store view-->
132133
<actionGroup name="SwitchToTheNewStoreView">
133134
<arguments>
134-
<argument name="storeViewName" type="string"/>
135+
<argument name="storeViewName"/>
135136
</arguments>
136-
<scrollTo selector="{{AdminProductContentSection.pageHeader}}" stepKey="scrollToUp"/>
137+
<scrollTo selector="{{AdminHeaderSection.pageTitle}}" stepKey="scrollToUp"/>
137138
<waitForElementVisible selector="{{AdminProductFormActionSection.changeStoreButton}}" stepKey="waitForElementBecomeVisible"/>
138139
<click selector="{{AdminProductFormActionSection.changeStoreButton}}" stepKey="clickStoreviewSwitcher"/>
139-
<click selector="{{AdminProductFormActionSection.selectStoreView(storeViewName)}}" stepKey="chooseStoreView"/>
140+
<click selector="{{AdminProductFormActionSection.selectStoreView(storeViewName.name)}}" stepKey="chooseStoreView"/>
140141
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="acceptStoreSwitchingMessage"/>
141142
<waitForPageLoad stepKey="waitForPageLoad"/>
142143
</actionGroup>
@@ -151,4 +152,21 @@
151152
<waitForPageLoad stepKey="waitForPageOpened"/>
152153
<checkOption selector="{{ProductInWebsitesSection.website(website)}}" stepKey="selectWebsite"/>
153154
</actionGroup>
155+
156+
<!--Remove product image-->
157+
<actionGroup name="RemoveProductImage">
158+
<conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductImagesSection"/>
159+
<waitForPageLoad time="30" stepKey="waitForPageRefresh"/>
160+
<click selector="{{AdminProductImagesSection.removeImageButton}}" stepKey="clickRemoveImage"/>
161+
</actionGroup>
162+
163+
<!-- Assert no product image in Admin Product page -->
164+
<actionGroup name="AssertProductImageNotInAdminProductPage">
165+
<arguments>
166+
<argument name="image" defaultValue="MagentoLogo" />
167+
</arguments>
168+
<conditionalClick selector="{{AdminProductImagesSection.productImagesToggle}}" dependentSelector="{{AdminProductImagesSection.imageUploadButton}}" visible="false" stepKey="openProductImagesSection"/>
169+
<waitForPageLoad stepKey="waitForPageLoad"/>
170+
<dontSeeElement selector="{{AdminProductImagesSection.imageFile(image.filename)}}" stepKey="seeImage"/>
171+
</actionGroup>
154172
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Page/AdminProductAttributeEditPage.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
<page name="AdminProductAttributeEditPage" url="catalog/product_attribute/edit/" area="admin" module="Magento_Catalog">
1212
<section name="AdminProductAttributeEditSection"/>
1313
<section name="AdminConfirmationModalSection"/>
14+
<section name="AdminEditAttributeStorefrontPropertiesSection"/>
1415
</page>
1516
</pages>

app/code/Magento/Catalog/Test/Mftf/Page/AdminProductAttributeGridPage.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
1010
<page name="AdminProductAttributeGridPage" url="catalog/product_attribute" area="admin" module="Catalog">
1111
<section name="AdminProductAttributeGridSection"/>
12+
<section name="AdminDataGridHeaderSection"/>
1213
</page>
1314
</pages>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="AdminEditAttributeStorefrontPropertiesSection">
12+
<element name="storeFrontPropertiesTab" selector="#product_attribute_tabs_front" type="button"/>
13+
<element name="useForPromoRuleConditions" type="select" selector="#is_used_for_promo_rules"/>
14+
</section>
15+
</sections>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAttributeGridSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616
<element name="resetFilter" type="button" selector="button[data-action='grid-filter-reset']" timeout="30"/>
1717
<element name="firstRow" type="button" selector="//*[@id='attributeGrid_table']/tbody/tr[1]"/>
1818
<element name="attributeCodeFilterInput" type="input" selector=".admin__data-grid-filters input[name='attribute_code']"/>
19+
<element name="filterByAttributeCode" type="input" selector="#attributeGrid_filter_attribute_code"/>
1920
</section>
2021
</sections>

app/code/Magento/Catalog/Test/Mftf/Test/AdminFilteringCategoryProductsUsingScopeSelectorTest.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@
129129
<waitForPageLoad stepKey="waitForCategoryPageLoad1"/>
130130
<click selector="{{AdminCategoryMainActionsSection.categoryStoreViewOption('Default Store View')}}"
131131
stepKey="clickStoreView"/>
132+
<waitForElementVisible selector="{{AdminCategoryMainActionsSection.categoryStoreViewModalAccept}}"
133+
stepKey="waitForPopup1"/>
132134
<click selector="{{AdminCategoryMainActionsSection.categoryStoreViewModalAccept}}" stepKey="clickActionAccept"/>
133135
<waitForPageLoad stepKey="waitForCategoryPageLoad2"/>
134136
<click selector="{{AdminCategoryProductsSection.sectionHeader}}" stepKey="openProductSection1"/>
@@ -148,6 +150,8 @@
148150
<waitForPageLoad stepKey="waitForCategoryPageLoad3"/>
149151
<click selector="{{AdminCategoryMainActionsSection.categoryStoreViewOption(secondStore.name)}}"
150152
stepKey="clickStoreView1"/>
153+
<waitForElementVisible selector="{{AdminCategoryMainActionsSection.categoryStoreViewModalAccept}}"
154+
stepKey="waitForPopup2"/>
151155
<click selector="{{AdminCategoryMainActionsSection.categoryStoreViewModalAccept}}"
152156
stepKey="clickActionAccept1"/>
153157
<waitForPageLoad stepKey="waitForCategoryPageLoad4"/>

0 commit comments

Comments
 (0)