Skip to content

Commit

Permalink
Merge branch '2.4-develop' into fix-missing-vatid-at-multishipping-re…
Browse files Browse the repository at this point in the history
…gistration-page
  • Loading branch information
engcom-Hotel authored Dec 21, 2020
2 parents d01133d + 05a3e7e commit 13b966a
Show file tree
Hide file tree
Showing 129 changed files with 1,204 additions and 319 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,8 @@ private function fetchTierPrices(array $productIds): array
)
->where(
'ap.' . $productEntityLinkField . ' IN (?)',
$productIds
$productIds,
\Zend_Db::INT_TYPE
);

if ($priceFromFilter !== null) {
Expand Down
8 changes: 7 additions & 1 deletion app/code/Magento/Backend/App/Area/FrontNameResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,13 @@ public function isHostBackend()
if ($this->scopeConfig->getValue(self::XML_PATH_USE_CUSTOM_ADMIN_URL, ScopeInterface::SCOPE_STORE)) {
$backendUrl = $this->scopeConfig->getValue(self::XML_PATH_CUSTOM_ADMIN_URL, ScopeInterface::SCOPE_STORE);
} else {
$backendUrl = $this->scopeConfig->getValue(Store::XML_PATH_UNSECURE_BASE_URL, ScopeInterface::SCOPE_STORE);
$backendUrl = $this->config->getValue(Store::XML_PATH_UNSECURE_BASE_URL);
if ($backendUrl === null) {
$backendUrl = $this->scopeConfig->getValue(
Store::XML_PATH_UNSECURE_BASE_URL,
ScopeInterface::SCOPE_STORE
);
}
}
$host = $this->request->getServer('HTTP_HOST', '');
return stripos($this->getHostWithPort($backendUrl), (string) $host) !== false;
Expand Down
5 changes: 4 additions & 1 deletion app/code/Magento/Backend/Block/Widget/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*/
namespace Magento\Backend\Block\Widget;

use Magento\Backend\Block\Template\Context;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Math\Random;
use Magento\Backend\Block\Template\Context;
use Magento\Framework\View\Helper\SecureHtmlRenderer;

/**
Expand Down Expand Up @@ -125,6 +125,9 @@ protected function _prepareAttributes($title, $classes, $disabled)
'value' => $this->getValue(),
'disabled' => $disabled,
];
if ($this->hasData('onclick_attribute')) {
$attributes['onclick'] = $this->getData('onclick_attribute');
}
if ($this->hasData('backend_button_widget_hook_id')) {
$attributes['backend-button-widget-hook-id'] = $this->getData('backend_button_widget_hook_id');
}
Expand Down
12 changes: 12 additions & 0 deletions app/code/Magento/Backend/Test/Unit/Block/Widget/ButtonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,16 @@ public function getAttributesHtmlDataProvider()
]
];
}

/**
* Verifies ability of adding button onclick attribute
*
* @return void
*/
public function testOnClickAttribute(): void
{
$this->_blockMock->setData(['onclick_attribute' => 'value']);
$attributes = $this->_blockMock->getAttributesHtml();
$this->assertStringContainsString('onclick', $attributes);
}
}
3 changes: 2 additions & 1 deletion app/code/Magento/Bundle/Model/ResourceModel/Selection.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ public function getParentIdsByChild($childId)
['e.entity_id as parent_product_id']
)->where(
$this->getMainTable() . '.product_id IN(?)',
$childId
$childId,
\Zend_Db::INT_TYPE
);

return $connection->fetchCol($select);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@
<argument name="productId" value="$createFixedBundleProduct.id$"/>
</actionGroup>
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
<!--Perform reindex and flush cache-->
<actionGroup ref="AdminReindexAndFlushCache" stepKey="reindexAndFlushCache"/>
<comment userInput="Adding the comment to replace AdminReindexAndFlushCache action group ('indexer:reindex', 'cache:flush' commands) for preserving Backward Compatibility" stepKey="reindexAndFlushCache"/>
</before>
<after>
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProductForBundleItem"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,11 @@ protected function _copyRelationIndexData($parentIds, $excludeIds = null)
[]
)->where(
'e.entity_id IN(?)',
$parentIds
$parentIds,
\Zend_Db::INT_TYPE
);
if (!empty($excludeIds)) {
$select->where('child_id NOT IN(?)', $excludeIds);
$select->where('child_id NOT IN(?)', $excludeIds, \Zend_Db::INT_TYPE);
}

$children = $this->getConnection()->fetchCol($select);
Expand All @@ -479,7 +480,8 @@ protected function _copyRelationIndexData($parentIds, $excludeIds = null)
$this->getIndexTargetTableByDimension($dimensions)
)->where(
'entity_id IN(?)',
$children
$children,
\Zend_Db::INT_TYPE
);
$query = $select->insertFromSelect($this->_defaultIndexerResource->getIdxTable(), [], false);
$this->getConnection()->query($query);
Expand Down Expand Up @@ -578,13 +580,14 @@ private function getParentProductsTypes(array $productsIds)
['e.entity_id as parent_id', 'type_id']
)->where(
'l.child_id IN(?)',
$productsIds
$productsIds,
\Zend_Db::INT_TYPE
);
$pairs = $this->getConnection()->fetchPairs($select);

$byType = [];
foreach ($pairs as $productId => $productType) {
$byType[$productType][$productId] = $productId;
$byType[$productType][$productId] = (int)$productId;
}

return $byType;
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Model/Product/Type/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ public function getTierPrices($product)
if (array_key_exists('website_price', $price)) {
$value = $price['website_price'];
} else {
$value = $price['price'];
$value = $price['price'] ?? 0;
}
$tierPrice->setValue($value);
$tierPrice->setQty($price['price_qty']);
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Model/ResourceModel/Attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected function _clearUselessAttributeValues(\Magento\Framework\Model\Abstrac
$attributeStoreIds = array_keys($this->_storeManager->getStores());
if (!empty($attributeStoreIds)) {
$delCondition = [
'attribute_id = ?' => $object->getId(),
'attribute_id = ?' => (int)$object->getId(),
'store_id IN(?)' => $attributeStoreIds,
];
$this->getConnection()->delete($object->getBackendTable(), $delCondition);
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/Catalog/Model/ResourceModel/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,8 @@ public function verifyIds(array $ids)
'entity_id'
)->where(
'entity_id IN(?)',
$ids
$ids,
\Zend_Db::INT_TYPE
);

return $this->getConnection()->fetchCol($select);
Expand Down
22 changes: 14 additions & 8 deletions app/code/Magento/Catalog/Model/ResourceModel/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ protected function _getCategoryAttribute($attributeCode, $categoryIds, $storeId)
['value' => $attributeCode, 'entity_id' => 'entity_id']
)->where(
'entity_id IN(?)',
$categoryIds
$categoryIds,
\Zend_Db::INT_TYPE
);
} elseif ($this->_categoryAttributes[$attributeCode]['is_global'] || $storeId == 0) {
$select->from(
Expand All @@ -216,7 +217,8 @@ protected function _getCategoryAttribute($attributeCode, $categoryIds, $storeId)
['value']
)->where(
"t1.{$identifierFiled} IN(?)",
$categoryIds
$categoryIds,
\Zend_Db::INT_TYPE
)->where(
'e.attribute_id = :attribute_id'
)->where(
Expand Down Expand Up @@ -245,7 +247,8 @@ protected function _getCategoryAttribute($attributeCode, $categoryIds, $storeId)
't1.attribute_id = :attribute_id'
)->where(
"e.entity_id IN(?)",
$categoryIds
$categoryIds,
\Zend_Db::INT_TYPE
)->group('e.entity_id');

$bind['attribute_id'] = $this->_categoryAttributes[$attributeCode]['attribute_id'];
Expand Down Expand Up @@ -308,7 +311,8 @@ public function _getProductAttribute($attributeCode, $productIds, $storeId)
0
)->where(
'entity_id IN(?)',
$productIds
$productIds,
\Zend_Db::INT_TYPE
);
} else {
$valueExpr = $connection->getCheckSql('t2.value_id > 0', 't2.value', 't1.value');
Expand All @@ -326,7 +330,8 @@ public function _getProductAttribute($attributeCode, $productIds, $storeId)
't1.attribute_id = :attribute_id'
)->where(
't1.entity_id IN(?)',
$productIds
$productIds,
\Zend_Db::INT_TYPE
);
$bind['store_id'] = $storeId;
}
Expand Down Expand Up @@ -430,7 +435,7 @@ protected function _getCategories($categoryIds, $storeId = null, $path = null)

// Prepare variables for checking whether categories belong to store
if ($path === null) {
$select->where('main_table.entity_id IN(?)', $categoryIds);
$select->where('main_table.entity_id IN(?)', $categoryIds, \Zend_Db::INT_TYPE);
} else {
// Ensure that path ends with '/', otherwise we can get wrong results - e.g. $path = '1/2' will get '1/20'
if (substr($path, -1) != '/') {
Expand Down Expand Up @@ -569,7 +574,7 @@ protected function _getProducts($productIds, $storeId, $entityId, &$lastEntityId
$this->_productLimit
);
if ($productIds !== null) {
$select->where('e.entity_id IN(?)', $productIds);
$select->where('e.entity_id IN(?)', $productIds, \Zend_Db::INT_TYPE);
}

$rowSet = $connection->fetchAll($select, $bind);
Expand All @@ -591,7 +596,8 @@ protected function _getProducts($productIds, $storeId, $entityId, &$lastEntityId
['product_id', 'category_id']
)->where(
'product_id IN(?)',
array_keys($products)
array_keys($products),
\Zend_Db::INT_TYPE
);
$categories = $connection->fetchAll($select);
foreach ($categories as $category) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminDeleteAllProductAttributesFilteredByCodeActionGroup">
<annotations>
<description>Open product attributes grid filter it by attribute code and delete all found attributes one by one.</description>
</annotations>
<arguments>
<argument name="codeFilter" type="string" defaultValue="fake-code"/>
</arguments>

<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/>
<!-- It sometimes is loading too long for default 10s -->
<waitForPageLoad time="60" stepKey="waitForPageFullyLoaded"/>
<click selector="{{AdminProductAttributeGridSection.ResetFilter}}" stepKey="clearExistingFilters"/>
<fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{codeFilter}}" stepKey="fillAttributeCodeFilterField"/>
<click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="applyGridFilter"/>
<helper class="\Magento\Catalog\Test\Mftf\Helper\CatalogHelper" method="deleteAllProductAttributesOneByOne" stepKey="deleteAllProductAttributesOneByOne">
<argument name="notEmptyRow">{{AdminDataGridTableSection.firstNotEmptyRow2}}</argument>
<argument name="modalAcceptButton">{{AdminConfirmationModalSection.ok}}</argument>
<argument name="deleteButton">{{AdminMainActionsSection.delete}}</argument>
<argument name="successMessageContainer">{{AdminMessagesSection.success}}</argument>
<argument name="successMessage">You deleted the product attribute.</argument>
</helper>
<waitForElementVisible selector="{{AdminDataGridTableSection.dataGridEmpty}}" stepKey="waitDataGridEmptyMessageAppears"/>
<see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/>
<click selector="{{AdminProductAttributeGridSection.ResetFilter}}" stepKey="clearExistingFiltersAgain"/>
</actionGroup>
</actionGroups>
59 changes: 59 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Helper/CatalogHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Catalog\Test\Mftf\Helper;

use Facebook\WebDriver\Remote\RemoteWebDriver as FacebookWebDriver;
use Facebook\WebDriver\WebDriverBy;
use Magento\FunctionalTestingFramework\Helper\Helper;
use Magento\FunctionalTestingFramework\Module\MagentoWebDriver;

/**
* Class for MFTF helpers for Catalog module.
*/
class CatalogHelper extends Helper
{
/**
* Delete all product attributes one by one.
*
* @param string $notEmptyRow
* @param string $modalAcceptButton
* @param string $deleteButton
* @param string $successMessageContainer
* @param string $successMessage
* @retrun void
*/
public function deleteAllProductAttributesOneByOne(
string $notEmptyRow,
string $modalAcceptButton,
string $deleteButton,
string $successMessageContainer,
string $successMessage
): void {
try {
/** @var MagentoWebDriver $webDriver */
$magentoWebDriver = $this->getModule('\Magento\FunctionalTestingFramework\Module\MagentoWebDriver');
/** @var FacebookWebDriver $webDriver */
$webDriver = $magentoWebDriver->webDriver;
$gridRows = $webDriver->findElements(WebDriverBy::cssSelector($notEmptyRow));
while (!empty($gridRows)) {
$gridRows[0]->click();
$magentoWebDriver->waitForPageLoad(30);
$magentoWebDriver->click($deleteButton);
$magentoWebDriver->waitForPageLoad(30);
$magentoWebDriver->waitForElementVisible($modalAcceptButton);
$magentoWebDriver->click($modalAcceptButton);
$magentoWebDriver->waitForPageLoad(60);
$magentoWebDriver->waitForElementVisible($successMessageContainer);
$magentoWebDriver->see($successMessage, $successMessageContainer);
$gridRows = $webDriver->findElements(WebDriverBy::cssSelector($notEmptyRow));
}
} catch (\Exception $e) {
$this->fail($e->getMessage());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@
</actionGroup>
<actionGroup ref="AdminSubmitAdvancedInventoryFormActionGroup" stepKey="clickDoneButton"/>
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/>
<!--Run re-index task -->
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
<argument name="indices" value=""/>
</actionGroup>
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/>

<!--Verify product is visible in category front page -->
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="goToHomepage"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,7 @@
<argument name="targetPath" value="catalog/category/view/id/{$categoryId}"/>
</actionGroup>

<!--Clear cache and reindex-->
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
<argument name="indices" value=""/>
</actionGroup>
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/>
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
<argument name="tags" value=""/>
</actionGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@
<actionGroup ref="CreateStoreViewActionGroup" stepKey="createCustomStoreViewFr">
<argument name="storeView" value="customStoreFR"/>
</actionGroup>
<!--Run full reindex and clear caches -->
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
<argument name="indices" value=""/>
</actionGroup>
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/>
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
<argument name="tags" value=""/>
</actionGroup>
Expand All @@ -47,9 +44,7 @@
<after>
<magentoCLI stepKey="setFlatCatalogCategory" command="config:set catalog/frontend/flat_catalog_category 0 "/>
<magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="realtime" />
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="indexerReindex">
<argument name="indices" value=""/>
</actionGroup>
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="indexerReindex"/>
<deleteData stepKey="deleteCategory" createDataKey="createCategory"/>
<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreViewEn">
<argument name="customStore" value="customStoreEN"/>
Expand All @@ -68,10 +63,7 @@
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccessMessage"/>
<see selector="{{AdminCategoryContentSection.categoryPageTitle}}" userInput="{{CatNotActive.name}}" stepKey="seeUpdatedCategoryTitle"/>
<dontSeeCheckboxIsChecked selector="{{AdminCategoryBasicFieldSection.enableCategoryLabel}}" stepKey="verifyInactiveCategory"/>
<!--Run full reindex and clear caches -->
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
<argument name="indices" value=""/>
</actionGroup>
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="reindex"/>
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
<argument name="tags" value=""/>
</actionGroup>
Expand Down
Loading

0 comments on commit 13b966a

Please sign in to comment.