Skip to content

Commit 389f396

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-97237' into 2.3-develop-mftf-pr13
2 parents abb561a + 366b061 commit 389f396

File tree

49 files changed

+818
-307
lines changed

Some content is hidden

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

49 files changed

+818
-307
lines changed

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
use Magento\Backend\Block\Template\Context;
1010
use Magento\Backend\Block\Widget\Accordion;
11-
use Magento\Backend\Block\Widget\Tabs as WigetTabs;
11+
use Magento\Backend\Block\Widget\Tabs as WidgetTabs;
1212
use Magento\Backend\Model\Auth\Session;
1313
use Magento\Catalog\Helper\Catalog;
1414
use Magento\Catalog\Helper\Data;
@@ -22,7 +22,7 @@
2222
* Admin product edit tabs
2323
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2424
*/
25-
class Tabs extends WigetTabs
25+
class Tabs extends WidgetTabs
2626
{
2727
const BASIC_TAB_GROUP_CODE = 'basic';
2828

@@ -109,7 +109,7 @@ public function __construct(
109109
}
110110

111111
/**
112-
* @return void
112+
* @inheritdoc
113113
*/
114114
protected function _construct()
115115
{
@@ -119,6 +119,8 @@ protected function _construct()
119119
}
120120

121121
/**
122+
* Get group collection.
123+
*
122124
* @param int $attributeSetId
123125
* @return \Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\Collection
124126
*/
@@ -131,10 +133,11 @@ public function getGroupCollection($attributeSetId)
131133
}
132134

133135
/**
134-
* @return $this
136+
* @inheritdoc
135137
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
136-
* @SuppressWarnings(PHPMD.NPathComplexity)
137138
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
139+
* @SuppressWarnings(PHPMD.NPathComplexity)
140+
* @SuppressWarnings(PHPMD.RequestAwareBlockMethod)
138141
*/
139142
protected function _prepareLayout()
140143
{
@@ -315,6 +318,8 @@ public function getAttributeTabBlock()
315318
}
316319

317320
/**
321+
* Set attribute tab block.
322+
*
318323
* @param string $attributeTabBlock
319324
* @return $this
320325
*/
@@ -337,6 +342,8 @@ protected function _translateHtml($html)
337342
}
338343

339344
/**
345+
* Get accordion.
346+
*
340347
* @param string $parentTab
341348
* @return string
342349
*/

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ protected function duplicate($product)
318318

319319
$this->resourceModel->duplicate(
320320
$this->getAttribute()->getAttributeId(),
321-
isset($mediaGalleryData['duplicate']) ? $mediaGalleryData['duplicate'] : [],
321+
$mediaGalleryData['duplicate'] ?? [],
322322
$product->getOriginalLinkId(),
323323
$product->getData($this->metadata->getLinkField())
324324
);

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Catalog\Model\ResourceModel\Product;
78

89
use Magento\Store\Model\Store;
@@ -149,7 +150,7 @@ public function loadProductGalleryByAttributeId($product, $attributeId)
149150
*/
150151
protected function createBaseLoadSelect($entityId, $storeId, $attributeId)
151152
{
152-
$select = $this->createBatchBaseSelect($storeId, $attributeId);
153+
$select = $this->createBatchBaseSelect($storeId, $attributeId);
153154

154155
$select = $select->where(
155156
'entity.' . $this->metadata->getLinkField() . ' = ?',
@@ -378,9 +379,9 @@ public function deleteGalleryValueInStore($valueId, $entityId, $storeId)
378379
$conditions = implode(
379380
' AND ',
380381
[
381-
$this->getConnection()->quoteInto('value_id = ?', (int) $valueId),
382-
$this->getConnection()->quoteInto($this->metadata->getLinkField() . ' = ?', (int) $entityId),
383-
$this->getConnection()->quoteInto('store_id = ?', (int) $storeId)
382+
$this->getConnection()->quoteInto('value_id = ?', (int)$valueId),
383+
$this->getConnection()->quoteInto($this->metadata->getLinkField() . ' = ?', (int)$entityId),
384+
$this->getConnection()->quoteInto('store_id = ?', (int)$storeId)
384385
]
385386
);
386387

@@ -408,7 +409,7 @@ public function duplicate($attributeId, $newFiles, $originalProductId, $newProdu
408409

409410
$select = $this->getConnection()->select()->from(
410411
[$this->getMainTableAlias() => $this->getMainTable()],
411-
['value_id', 'value']
412+
['value_id', 'value', 'media_type', 'disabled']
412413
)->joinInner(
413414
['entity' => $this->getTable(self::GALLERY_VALUE_TO_ENTITY_TABLE)],
414415
$this->getMainTableAlias() . '.value_id = entity.value_id',
@@ -425,16 +426,16 @@ public function duplicate($attributeId, $newFiles, $originalProductId, $newProdu
425426

426427
// Duplicate main entries of gallery
427428
foreach ($this->getConnection()->fetchAll($select) as $row) {
428-
$data = [
429-
'attribute_id' => $attributeId,
430-
'value' => isset($newFiles[$row['value_id']]) ? $newFiles[$row['value_id']] : $row['value'],
431-
];
429+
$data = $row;
430+
$data['attribute_id'] = $attributeId;
431+
$data['value'] = $newFiles[$row['value_id']] ?? $row['value'];
432+
unset($data['value_id']);
432433

433434
$valueIdMap[$row['value_id']] = $this->insertGallery($data);
434435
$this->bindValueToEntity($valueIdMap[$row['value_id']], $newProductId);
435436
}
436437

437-
if (count($valueIdMap) == 0) {
438+
if (count($valueIdMap) === 0) {
438439
return [];
439440
}
440441

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@
1919
<click selector="{{AdminProductFiltersSection.apply}}" stepKey="clickApplyFiltersButton"/>
2020
</actionGroup>
2121

22+
<actionGroup name="SearchForProductOnBackendByNameActionGroup" extends="SearchForProductOnBackendActionGroup">
23+
<arguments>
24+
<argument name="productName" type="string"/>
25+
</arguments>
26+
<remove keyForRemoval="fillSkuFieldOnFiltersSection"/>
27+
<fillField userInput="{{productName}}" selector="{{AdminProductFiltersSection.nameInput}}" after="cleanFiltersIfTheySet" stepKey="fillNameFieldOnFiltersSection"/>
28+
</actionGroup>
29+
2230
<actionGroup name="ClearProductsFilterActionGroup">
2331
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
2432
<waitForPageLoad time="30" stepKey="waitForProductsPageToLoad"/>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="RelatedProductLink" type="product_link">
12+
<var key="sku" entityKey="sku" entityType="product2"/>
13+
<var key="linked_product_sku" entityKey="sku" entityType="product"/>
14+
<data key="link_type">related</data>
15+
<data key="linked_product_type">simple</data>
16+
<data key="position">1</data>
17+
<requiredEntity type="product_link_extension_attribute">Qty1000</requiredEntity>
18+
</entity>
19+
</entities>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="OneRelatedProductLink" type="product_links">
12+
<requiredEntity type="product_link">RelatedProductLink</requiredEntity>
13+
</entity>
14+
</entities>
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="ProductLinkWidget" extends="ProductsListWidget">
12+
<data key="type">Catalog Product Link</data>
13+
<data key="template">Product Link Block Template</data>
14+
</entity>
15+
</entities>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11+
<page name="AdminNewWidgetPage" url="admin/widget_instance/new/" area="admin" module="Magento_Widget">
12+
<section name="AdminNewWidgetSelectProductPopupSection"/>
13+
</page>
14+
</pages>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminNewWidgetSection">
12+
<element name="selectProduct" type="button" selector=".btn-chooser" timeout="30"/>
13+
</section>
14+
</sections>
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="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminNewWidgetSelectProductPopupSection">
12+
<element name="filterBySku" type="input" selector=".data-grid-filters input[name='chooser_sku']"/>
13+
<element name="firstRow" type="select" selector=".even>td" timeout="20"/>
14+
</section>
15+
</sections>

0 commit comments

Comments
 (0)