Skip to content

Commit 016ed5e

Browse files
committed
Merge branch 'EPAM-PR-14' of github.com:magento-epam/magento2ce into EPAM-PR-11-14-15
2 parents 727dffb + 7330227 commit 016ed5e

File tree

22 files changed

+375
-48
lines changed

22 files changed

+375
-48
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements
7171
*/
7272
const STORE_ID = 'store_id';
7373

74+
/**
75+
* Product Url path.
76+
*/
77+
const URL_PATH = 'url_path';
78+
7479
/**
7580
* @var string
7681
*/
@@ -923,8 +928,8 @@ public function beforeSave()
923928
*
924929
* If value specified, it will be set.
925930
*
926-
* @param bool $value
927-
* @return bool
931+
* @param bool $value
932+
* @return bool
928933
*/
929934
public function canAffectOptions($value = null)
930935
{

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
namespace Magento\Catalog\Model\Product;
99

1010
use Magento\Catalog\Api\Data\ProductInterface;
11+
use Magento\Catalog\Model\Product;
1112

13+
/**
14+
* The copier creates product duplicates.
15+
*/
1216
class Copier
1317
{
1418
/**
@@ -49,7 +53,7 @@ public function __construct(
4953
* @param \Magento\Catalog\Model\Product $product
5054
* @return \Magento\Catalog\Model\Product
5155
*/
52-
public function copy(\Magento\Catalog\Model\Product $product)
56+
public function copy(Product $product)
5357
{
5458
$product->getWebsiteIds();
5559
$product->getCategoryIds();
@@ -79,6 +83,7 @@ public function copy(\Magento\Catalog\Model\Product $product)
7983
? $matches[1] . '-' . ($matches[2] + 1)
8084
: $urlKey . '-1';
8185
$duplicate->setUrlKey($urlKey);
86+
$duplicate->setData(Product::URL_PATH, null);
8287
try {
8388
$duplicate->save();
8489
$isDuplicateSaved = true;
@@ -94,6 +99,8 @@ public function copy(\Magento\Catalog\Model\Product $product)
9499
}
95100

96101
/**
102+
* Returns product option repository.
103+
*
97104
* @return Option\Repository
98105
* @deprecated 101.0.0
99106
*/
@@ -107,6 +114,8 @@ private function getOptionRepository()
107114
}
108115

109116
/**
117+
* Returns metadata pool.
118+
*
110119
* @return \Magento\Framework\EntityManager\MetadataPool
111120
* @deprecated 101.0.0
112121
*/

app/code/Magento/Catalog/Test/Unit/Model/Product/CopierTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Magento\Catalog\Api\Data\ProductInterface;
99
use \Magento\Catalog\Model\Product\Copier;
10+
use Magento\Catalog\Model\Product;
1011

1112
/**
1213
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -54,7 +55,7 @@ protected function setUp()
5455
\Magento\Catalog\Model\Product\Option\Repository::class
5556
);
5657
$this->optionRepositoryMock;
57-
$this->productMock = $this->createMock(\Magento\Catalog\Model\Product::class);
58+
$this->productMock = $this->createMock(Product::class);
5859
$this->productMock->expects($this->any())->method('getEntityId')->willReturn(1);
5960

6061
$this->metadata = $this->getMockBuilder(\Magento\Framework\EntityManager\EntityMetadata::class)
@@ -106,7 +107,7 @@ public function testCopy()
106107
$this->productMock->expects($this->once())->method('getResource')->will($this->returnValue($resourceMock));
107108

108109
$duplicateMock = $this->createPartialMock(
109-
\Magento\Catalog\Model\Product::class,
110+
Product::class,
110111
[
111112
'__wakeup',
112113
'setData',
@@ -147,10 +148,10 @@ public function testCopy()
147148
)->with(
148149
\Magento\Store\Model\Store::DEFAULT_STORE_ID
149150
);
150-
$duplicateMock->expects($this->once())->method('setData')->with($productData);
151+
$duplicateMock->expects($this->atLeastOnce())->method('setData')->willReturn($duplicateMock);
151152
$this->copyConstructorMock->expects($this->once())->method('build')->with($this->productMock, $duplicateMock);
152153
$duplicateMock->expects($this->once())->method('getUrlKey')->willReturn('urk-key-1');
153-
$duplicateMock->expects($this->once())->method('setUrlKey')->with('urk-key-2');
154+
$duplicateMock->expects($this->once())->method('setUrlKey')->with('urk-key-2')->willReturn($duplicateMock);
154155
$duplicateMock->expects($this->once())->method('save');
155156

156157
$this->metadata->expects($this->any())->method('getLinkField')->willReturn('linkField');

app/code/Magento/CatalogSearch/Model/Search/FilterMapper/CustomAttributeFilter.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
use Magento\Catalog\Model\Product;
1717

1818
/**
19-
* Class CustomAttributeFilter
20-
* Applies filters by custom attributes to base select
19+
* Applies filters by custom attributes to base select.
2120
*
2221
* @deprecated CatalogSearch will be removed in 2.4, and {@see \Magento\ElasticSearch}
2322
* will replace it as the default search engine.
@@ -74,13 +73,13 @@ public function __construct(
7473
* Applies filters by custom attributes to base select
7574
*
7675
* @param Select $select
77-
* @param FilterInterface[] ...$filters
76+
* @param FilterInterface[] $filters
7877
* @return Select
7978
* @throws \Magento\Framework\Exception\LocalizedException
8079
* @throws \InvalidArgumentException
8180
* @throws \DomainException
8281
*/
83-
public function apply(Select $select, FilterInterface ... $filters)
82+
public function apply(Select $select, FilterInterface ...$filters)
8483
{
8584
$select = clone $select;
8685
$mainTableAlias = $this->extractTableAliasFromSelect($select);
@@ -144,7 +143,6 @@ private function getJoinConditions($attrId, $mainTable, $joinTable)
144143
{
145144
return [
146145
sprintf('`%s`.`entity_id` = `%s`.`entity_id`', $mainTable, $joinTable),
147-
sprintf('`%s`.`source_id` = `%s`.`source_id`', $mainTable, $joinTable),
148146
$this->conditionManager->generateCondition(
149147
sprintf('%s.attribute_id', $joinTable),
150148
'=',

app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAccountInformationSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminCustomerAccountInformationSection">
12+
<element name="statusInactive" type="button" selector=".admin__actions-switch-label"/>
1213
<element name="accountInformationTitle" type="text" selector=".admin__page-nav-title"/>
1314
<element name="accountInformationButton" type="text" selector="//a/span[text()='Account Information']"/>
1415
<element name="firstName" type="input" selector="input[name='customer[firstname]']"/>

app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerFiltersSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminCustomerFiltersSection">
12+
<element name="customerStatus" type="button" selector="select[name='status']"/>
1213
<element name="filtersButton" type="button" selector="#container > div > div.admin__data-grid-header > div:nth-child(1) > div.data-grid-filters-actions-wrap > div > button" timeout="30"/>
1314
<element name="nameInput" type="input" selector="input[name=name]"/>
1415
<element name="emailInput" type="input" selector="input[name=email]"/>

app/code/Magento/Elasticsearch/Elasticsearch5/Model/Adapter/FieldType.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class FieldType
2828
/**#@-*/
2929

3030
/**
31+
* Get field type by attribute
32+
*
3133
* @param AbstractAttribute $attribute
3234
* @return string
3335
* @since 100.1.0
@@ -37,7 +39,7 @@ public function getFieldType($attribute)
3739
$backendType = $attribute->getBackendType();
3840
$frontendInput = $attribute->getFrontendInput();
3941

40-
if (in_array($backendType, ['timestamp', 'datetime'], true)) {
42+
if ($backendType === 'timestamp') {
4143
$fieldType = self::ES_DATA_TYPE_DATE;
4244
} elseif ((in_array($backendType, ['int', 'smallint'], true)
4345
|| (in_array($frontendInput, ['select', 'boolean'], true) && $backendType !== 'varchar'))

app/code/Magento/Elasticsearch/Model/Adapter/FieldType.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class FieldType
2727
/**#@-*/
2828

2929
/**
30+
* Get field type by attribute
31+
*
3032
* @param AbstractAttribute $attribute
3133
* @return string
3234
* @since 100.1.0
@@ -36,7 +38,7 @@ public function getFieldType($attribute)
3638
$backendType = $attribute->getBackendType();
3739
$frontendInput = $attribute->getFrontendInput();
3840

39-
if (in_array($backendType, ['timestamp', 'datetime'], true)) {
41+
if ($backendType === 'timestamp') {
4042
$fieldType = self::ES_DATA_TYPE_DATE;
4143
} elseif ((in_array($backendType, ['int', 'smallint'], true)
4244
|| (in_array($frontendInput, ['select', 'boolean'], true) && $backendType !== 'varchar'))

app/code/Magento/Elasticsearch/Test/Unit/Elasticsearch5/Model/Adapter/FieldTypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public static function attributeTypesProvider()
9494
['attr1', 'static', 'select', 'integer'],
9595
['attr1', 'static', 'text', 'text'],
9696
['attr1', 'timestamp', 'select', 'date'],
97-
['attr1', 'datetime', 'text', 'date'],
97+
['attr1', 'datetime', 'text', 'text'],
9898
['attr1', 'int', 'select', 'integer'],
9999
['attr1', 'decimal', 'text', 'float'],
100100
['attr1', 'varchar', 'select', 'text'],

app/code/Magento/Reports/Model/ResourceModel/Quote/Collection.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
*/
66
namespace Magento\Reports\Model\ResourceModel\Quote;
77

8+
use Magento\Store\Model\Store;
9+
810
/**
11+
* Collection of abandoned quotes with reports join.
12+
*
913
* @api
1014
* @since 100.0.2
1115
*/
@@ -48,6 +52,24 @@ public function __construct(
4852
$this->customerResource = $customerResource;
4953
}
5054

55+
/**
56+
* Filter collections by stores.
57+
*
58+
* @param array $storeIds
59+
* @param bool $withAdmin
60+
* @return $this
61+
*/
62+
public function addStoreFilter(array $storeIds, $withAdmin = true)
63+
{
64+
if ($withAdmin) {
65+
$storeIds[] = Store::DEFAULT_STORE_ID;
66+
}
67+
68+
$this->addFieldToFilter('store_id', ['in' => $storeIds]);
69+
70+
return $this;
71+
}
72+
5173
/**
5274
* Prepare for abandoned report
5375
*

0 commit comments

Comments
 (0)