Skip to content

Commit 9f66bed

Browse files
author
Mariana Lashch
committed
Merge branch '2.3-develop' of github.com:magento/magento2ce into port-94472
2 parents 7ba4b41 + 0aa3191 commit 9f66bed

File tree

51 files changed

+883
-197
lines changed

Some content is hidden

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

51 files changed

+883
-197
lines changed

app/code/Magento/Braintree/Test/Mftf/ActionGroup/ConfigureBraintreeActionGroup.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1010

1111
<actionGroup name="ConfigureBraintree">
1212
<!-- GoTo ConfigureBraintree fields -->
@@ -46,4 +46,8 @@
4646
<waitForElementVisible selector="{{BraintreeConfiguraionSection.successfulMessage}}" stepKey="waitForSuccessfullyConfigured" time="10"/>
4747
</actionGroup>
4848

49+
<actionGroup name="DisableBrainTree">
50+
<magentoCLI stepKey="disableBrainTree" command="config:set payment/braintree/active 0"/>
51+
<magentoCLI stepKey="disableBrainTreePaypal" command="config:set payment/braintree_paypal/active 0"/>
52+
</actionGroup>
4953
</actionGroups>

app/code/Magento/Braintree/Test/Mftf/ActionGroup/CreateNewOrderActionGroup.xml

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,7 @@
88
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
1010

11-
<actionGroup name="CreateNewOrderActionGroup">
12-
<click stepKey="createNewOrder" selector="{{NewOrderSection.createNewOrder}}"/>
13-
<waitForPageLoad stepKey="waitForCustomersList" time="3"/>
14-
<click stepKey="chooseCustomer" selector="{{NewOrderSection.customer}}"/>
15-
<waitForPageLoad stepKey="waitForOrderPage" time="3"/>
16-
<click stepKey="addProducts" selector="{{NewOrderSection.addProducts}}"/>
17-
<waitForPageLoad stepKey="waitForProducts" time="3"/>
18-
<click stepKey="chooseProducts" selector="{{NewOrderSection.chooseProduct}}"/>
19-
<waitForPageLoad stepKey="waitForProductChoose" time="3"/>
20-
<click stepKey="addSelectedProduct" selector="{{NewOrderSection.addSelectedProduct}}"/>
21-
<waitForAjaxLoad stepKey="waitForChoose" time="3"/>
22-
<click stepKey="openAddresses" selector="{{NewOrderSection.openAddresses}}"/>
23-
<click stepKey="chooseAddress" selector="{{NewOrderSection.chooseAddress}}"/>
24-
<fillField stepKey="fillState" selector="{{NewOrderSection.state}}" userInput="Yerevan"/>
25-
<scrollTo stepKey="scrollTo" selector="#order-methods"/>
26-
<waitForPageLoad stepKey="waitForMethods" time="3"/>
27-
<click stepKey="startJSMethodExecution" selector="{{NewOrderSection.openShippingMethods}}"/>
28-
<waitForPageLoad stepKey="waitForJSMethodExecution" time="3"/>
29-
<click stepKey="openShippingMethods" selector="{{NewOrderSection.openShippingMethods}}"/>
30-
<waitForPageLoad stepKey="waitForShippingMethods" time="3"/>
31-
<click stepKey="chooseShippingMethods" selector="{{NewOrderSection.shippingMethod}}"/>
32-
<waitForPageLoad stepKey="waitForShippingMethodChoose" time="4"/>
11+
<actionGroup name="useBraintreeForMasterCard">
3312
<click stepKey="chooseBraintree" selector="{{NewOrderSection.creditCardBraintree}}"/>
3413
<waitForPageLoad stepKey="waitForBraintreeConfigs" time="5"/>
3514
<click stepKey="openCardTypes" selector="{{NewOrderSection.openCardTypes}}"/>
@@ -56,11 +35,5 @@
5635
<fillField stepKey="fillCVV" selector="{{NewOrderSection.cvv}}" userInput="{{PaymentAndShippingInfo.cvv}}"/>
5736
<wait stepKey="waitForFillCVV" time="1"/>
5837
<switchToIFrame stepKey="switchBackFromCVV"/>
59-
60-
<click stepKey="submitOrder" selector="{{NewOrderSection.submitOrder}}"/>
61-
<waitForPageLoad stepKey="waitForSaveConfig" time="5"/>
62-
<waitForElementVisible selector="{{NewOrderSection.successMessage}}" stepKey="waitForSuccessMessage" time="1"/>
63-
6438
</actionGroup>
65-
6639
</actionGroups>

app/code/Magento/Braintree/Test/Mftf/Data/BraintreeData.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
<data key="firstName">John</data>
130130
<data key="lastName">Smith</data>
131131
<data key="password">admin123</data>
132-
<data key="email">mail@mail.com</data>
132+
<data key="email" unique="prefix">mail@mail.com</data>
133133
</entity>
134134

135135
<entity name="PaymentAndShippingInfo" type="data">

app/code/Magento/Braintree/Test/Mftf/Test/CreateAnAdminOrderUsingBraintreePaymentTest1.xml

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
<severity value="CRITICAL"/>
1818
<testCaseId value="MAGETWO-93677"/>
1919
<group value="braintree"/>
20-
<skip>
21-
<issueId value="MQE-1187" />
22-
</skip>
2320
</annotations>
2421

2522

@@ -28,11 +25,13 @@
2825
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
2926

3027
<!--CreateNewProduct-->
31-
<actionGroup ref="CreateNewProductActionGroup" stepKey="CreateNewProduct"/>
28+
<createData entity="_defaultCategory" stepKey="createCategory"/>
29+
<createData entity="_defaultProduct" stepKey="createProduct">
30+
<requiredEntity createDataKey="createCategory"/>
31+
</createData>
3232

3333
<!--Create New Customer-->
34-
<actionGroup ref="CreateCustomerActionGroup" stepKey="CreateCustomer"/>
35-
34+
<createData stepKey="createCustomer" entity="Simple_US_Customer"/>
3635
</before>
3736

3837

@@ -48,30 +47,49 @@
4847
<actionGroup ref="AdminCreateUserAction" stepKey="AdminCreateNewUser"/>
4948

5049
<!--SignOut-->
51-
<actionGroup ref="SignOut" stepKey="signOutFromAdmin"/>
50+
<actionGroup ref="logout" stepKey="signOutFromAdmin"/>
5251

5352
<!--SignIn New User-->
5453
<actionGroup ref="LoginNewUser" stepKey="signInNewUser"/>
5554
<waitForPageLoad stepKey="waitForLogin" time="3"/>
5655

5756
<!--Create New Order-->
58-
<actionGroup ref="CreateNewOrderActionGroup" stepKey="createNewOrder"/>
57+
<actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="navigateToNewOrder">
58+
<argument name="customer" value="Simple_US_Customer"/>
59+
</actionGroup>
60+
61+
<actionGroup ref="addSimpleProductToOrder" stepKey="addProduct">
62+
<argument name="product" value="_defaultProduct"/>
63+
</actionGroup>
64+
65+
<actionGroup ref="fillOrderCustomerInformation" stepKey="fillCustomerAddress">
66+
<argument name="customer" value="Simple_US_Customer"/>
67+
<argument name="address" value="US_Address_TX"/>
68+
</actionGroup>
69+
70+
<actionGroup ref="orderSelectFlatRateShipping" stepKey="selectFlatRateShipping"/>
71+
72+
<waitForPageLoad stepKey="waitForShippingToFinish"/>
5973

74+
<actionGroup ref="useBraintreeForMasterCard" stepKey="selectCardWithBraintree"/>
75+
76+
<click stepKey="submitOrder" selector="{{NewOrderSection.submitOrder}}"/>
77+
<waitForPageLoad stepKey="waitForSaveConfig" time="5"/>
78+
<waitForElementVisible selector="{{NewOrderSection.successMessage}}" stepKey="waitForSuccessMessage" time="1"/>
6079

6180
<after>
81+
<!-- Disable BrainTree -->
82+
<actionGroup ref="DisableBrainTree" stepKey="disableBrainTree"/>
83+
6284
<!--SignOut-->
6385
<actionGroup ref="SignOut" stepKey="signOutFromNewUser"/>
6486
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
6587

6688
<!--Delete Product-->
67-
<actionGroup ref="DeleteProductActionGroup" stepKey="DeleteAllProducts">
68-
<argument name="productName" value="NewProductData.ProductName"/>
69-
</actionGroup>
89+
<deleteData stepKey="deleteProduct" createDataKey="createProduct"/>
7090

7191
<!--Delete Customer-->
72-
<actionGroup ref="DeleteCustomerActionGroup" stepKey="DeleteCustomer">
73-
<argument name="lastName" value="NewCustomerData.LastName"/>
74-
</actionGroup>
92+
<deleteData stepKey="deleteCustomer" createDataKey="createCustomer"/>
7593

7694
<!--Delete User -->
7795
<actionGroup ref="GoToAllUsers" stepKey="GoBackToAllUsers"/>
@@ -80,8 +98,6 @@
8098
<!--Delete Role-->
8199
<actionGroup ref="GoToUserRoles" stepKey="GoBackToUserRoles"/>
82100
<actionGroup ref="AdminDeleteRoleActionGroup" stepKey="AdminDeleteRoleActionGroup"/>
83-
84101
</after>
85-
86102
</test>
87103
</tests>

app/code/Magento/Bundle/Test/Mftf/Test/AdminBasicBundleProductAttributesTest.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
<description value="Admin should be able to set/edit all the basic product attributes when creating/editing a bundle product"/>
1616
<severity value="CRITICAL"/>
1717
<testCaseId value="MC-222"/>
18-
<skip>
19-
<issueId value="MQE-1214"/>
20-
</skip>
2118
<group value="Bundle"/>
2219
</annotations>
2320
<before>

app/code/Magento/Catalog/Model/Category/Link/SaveHandler.php

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
namespace Magento\Catalog\Model\Category\Link;
77

88
use Magento\Catalog\Api\Data\CategoryLinkInterface;
9-
use Magento\Catalog\Model\Indexer\Product\Category;
109
use Magento\Framework\EntityManager\Operation\ExtensionInterface;
1110

1211
/**
@@ -40,6 +39,8 @@ public function __construct(
4039
}
4140

4241
/**
42+
* Execute
43+
*
4344
* @param object $entity
4445
* @param array $arguments
4546
* @return object
@@ -78,6 +79,8 @@ public function execute($entity, $arguments = [])
7879
}
7980

8081
/**
82+
* Get category links positions
83+
*
8184
* @param object $entity
8285
* @return array
8386
*/
@@ -106,27 +109,19 @@ private function getCategoryLinksPositions($entity)
106109
*/
107110
private function mergeCategoryLinks($newCategoryPositions, $oldCategoryPositions)
108111
{
109-
$result = [];
110112
if (empty($newCategoryPositions)) {
111-
return $result;
113+
return [];
112114
}
113115

116+
$categoryPositions = array_combine(array_column($oldCategoryPositions, 'category_id'), $oldCategoryPositions);
114117
foreach ($newCategoryPositions as $newCategoryPosition) {
115-
$key = array_search(
116-
$newCategoryPosition['category_id'],
117-
array_column($oldCategoryPositions, 'category_id')
118-
);
119-
120-
if ($key === false) {
121-
$result[] = $newCategoryPosition;
122-
} elseif (isset($oldCategoryPositions[$key])
123-
&& $oldCategoryPositions[$key]['position'] != $newCategoryPosition['position']
124-
) {
125-
$result[] = $newCategoryPositions[$key];
126-
unset($oldCategoryPositions[$key]);
118+
$categoryId = $newCategoryPosition['category_id'];
119+
if (!isset($categoryPositions[$categoryId])) {
120+
$categoryPositions[$categoryId] = ['category_id' => $categoryId];
127121
}
122+
$categoryPositions[$categoryId]['position'] = $newCategoryPosition['position'];
128123
}
129-
$result = array_merge($result, $oldCategoryPositions);
124+
$result = array_values($categoryPositions);
130125

131126
return $result;
132127
}

app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Eraser.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,10 @@ public function removeDisabledProducts(array &$ids, $storeId)
118118
private function getSelectForProducts(array $ids)
119119
{
120120
$productTable = $this->productIndexerHelper->getTable('catalog_product_entity');
121-
$select = $this->connection->select()->from($productTable)
121+
$select = $this->connection->select()
122+
->from(['product_table' => $productTable])
122123
->columns('entity_id')
123-
->where('entity_id IN(?)', $ids);
124+
->where('product_table.entity_id IN(?)', $ids);
124125
return $select;
125126
}
126127

app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Indexer.php

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Magento\Catalog\Api\Data\ProductInterface;
1010
use Magento\Framework\App\ResourceConnection;
1111
use Magento\Framework\EntityManager\MetadataPool;
12+
use Magento\Store\Model\Store;
1213

1314
/**
1415
* Class Indexer
@@ -84,7 +85,7 @@ public function write($storeId, $productId, $valueFieldSuffix = '')
8485
[
8586
'entity_id' => 'e.entity_id',
8687
'attribute_id' => 't.attribute_id',
87-
'value' => $this->_connection->getIfNullSql('`t2`.`value`', '`t`.`value`'),
88+
'value' => 't.value'
8889
]
8990
);
9091

@@ -99,32 +100,30 @@ public function write($storeId, $productId, $valueFieldSuffix = '')
99100
sprintf('e.%s = t.%s ', $linkField, $linkField) . $this->_connection->quoteInto(
100101
' AND t.attribute_id IN (?)',
101102
array_keys($ids)
102-
) . ' AND t.store_id = 0',
103-
[]
104-
)->joinLeft(
105-
['t2' => $tableName],
106-
sprintf('t.%s = t2.%s ', $linkField, $linkField) .
107-
' AND t.attribute_id = t2.attribute_id ' .
108-
$this->_connection->quoteInto(
109-
' AND t2.store_id = ?',
110-
$storeId
111-
),
103+
) . ' AND ' . $this->_connection->quoteInto('t.store_id IN(?)', [
104+
Store::DEFAULT_STORE_ID,
105+
$storeId
106+
]),
112107
[]
113108
)->where(
114109
'e.entity_id = ' . $productId
115-
);
110+
)->order('t.store_id ASC');
116111
$cursor = $this->_connection->query($select);
117112
while ($row = $cursor->fetch(\Zend_Db::FETCH_ASSOC)) {
118113
$updateData[$ids[$row['attribute_id']]] = $row['value'];
119114
$valueColumnName = $ids[$row['attribute_id']] . $valueFieldSuffix;
120115
if (isset($describe[$valueColumnName])) {
121-
$valueColumns[$row['value']] = $valueColumnName;
116+
$valueColumns[$row['attribute_id']] = [
117+
'value' => $row['value'],
118+
'column_name' => $valueColumnName
119+
];
122120
}
123121
}
124122

125123
//Update not simple attributes (eg. dropdown)
126124
if (!empty($valueColumns)) {
127-
$valueIds = array_keys($valueColumns);
125+
$valueIds = array_column($valueColumns, 'value');
126+
$optionIdToAttributeName = array_column($valueColumns, 'column_name', 'value');
128127

129128
$select = $this->_connection->select()->from(
130129
['t' => $this->_productIndexerHelper->getTable('eav_attribute_option_value')],
@@ -133,14 +132,14 @@ public function write($storeId, $productId, $valueFieldSuffix = '')
133132
$this->_connection->quoteInto('t.option_id IN (?)', $valueIds)
134133
)->where(
135134
$this->_connection->quoteInto('t.store_id IN(?)', [
136-
\Magento\Store\Model\Store::DEFAULT_STORE_ID,
135+
Store::DEFAULT_STORE_ID,
137136
$storeId
138137
])
139138
)
140139
->order('t.store_id ASC');
141140
$cursor = $this->_connection->query($select);
142141
while ($row = $cursor->fetch(\Zend_Db::FETCH_ASSOC)) {
143-
$valueColumnName = $valueColumns[$row['option_id']];
142+
$valueColumnName = $optionIdToAttributeName[$row['option_id']];
144143
if (isset($describe[$valueColumnName])) {
145144
$updateData[$valueColumnName] = $row['value'];
146145
}
@@ -150,6 +149,7 @@ public function write($storeId, $productId, $valueFieldSuffix = '')
150149
$columnNames = array_keys($columns);
151150
$columnNames[] = 'attribute_set_id';
152151
$columnNames[] = 'type_id';
152+
$columnNames[] = $linkField;
153153
$select->from(
154154
['e' => $entityTableName],
155155
$columnNames
@@ -159,6 +159,7 @@ public function write($storeId, $productId, $valueFieldSuffix = '')
159159
$cursor = $this->_connection->query($select);
160160
$row = $cursor->fetch(\Zend_Db::FETCH_ASSOC);
161161
if (!empty($row)) {
162+
$linkFieldId = $linkField;
162163
foreach ($row as $columnName => $value) {
163164
$updateData[$columnName] = $value;
164165
}
@@ -170,7 +171,7 @@ public function write($storeId, $productId, $valueFieldSuffix = '')
170171
if (!empty($updateData)) {
171172
$updateData += ['entity_id' => $productId];
172173
if ($linkField !== $metadata->getIdentifierField()) {
173-
$updateData += [$linkField => $productId];
174+
$updateData += [$linkField => $linkFieldId];
174175
}
175176
$updateFields = [];
176177
foreach ($updateData as $key => $value) {

app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,17 @@ public function execute($id = null)
9696
/* @var $status \Magento\Eav\Model\Entity\Attribute */
9797
$status = $this->_productIndexerHelper->getAttribute(ProductInterface::STATUS);
9898
$statusTable = $status->getBackend()->getTable();
99+
$catalogProductEntityTable = $this->_productIndexerHelper->getTable('catalog_product_entity');
99100
$statusConditions = [
100-
'store_id IN(0,' . (int)$store->getId() . ')',
101-
'attribute_id = ' . (int)$status->getId(),
102-
$linkField . ' = ' . (int)$id,
101+
's.store_id IN(0,' . (int)$store->getId() . ')',
102+
's.attribute_id = ' . (int)$status->getId(),
103+
'e.entity_id = ' . (int)$id,
103104
];
104105
$select = $this->_connection->select();
105-
$select->from($statusTable, ['value'])
106+
$select->from(['e' => $catalogProductEntityTable], ['s.value'])
106107
->where(implode(' AND ', $statusConditions))
107-
->order('store_id DESC')
108+
->joinLeft(['s' => $statusTable], "e.{$linkField} = s.{$linkField}", [])
109+
->order('s.store_id DESC')
108110
->limit(1);
109111
$result = $this->_connection->query($select);
110112
$status = $result->fetchColumn(0);

app/code/Magento/Catalog/Model/ResourceModel/Category/Collection.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,7 @@ public function loadProductCount($items, $countRegular = true, $countAnchor = tr
322322
['e' => $this->getTable('catalog_category_entity')],
323323
'main_table.category_id=e.entity_id',
324324
[]
325-
)->where(
326-
'e.entity_id = :entity_id'
327-
)->orWhere(
328-
'e.path LIKE :c_path'
329-
);
325+
)->where('e.entity_id = :entity_id OR e.path LIKE :c_path');
330326
if ($websiteId) {
331327
$select->join(
332328
['w' => $this->getProductWebsiteTable()],

0 commit comments

Comments
 (0)