Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 73af931

Browse files
committed
Merge branch '2.3-develop' of github.com:magento/magento2ce into EPAM-PR-9
2 parents 0948d42 + ab5c07d commit 73af931

File tree

40 files changed

+613
-234
lines changed

40 files changed

+613
-234
lines changed

app/code/Magento/Analytics/ReportXml/DB/SelectBuilder.php

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
/**
1313
* Responsible for Select object creation, works as a builder. Returns Select as result;
14+
*
1415
* Used in SQL assemblers.
1516
*/
1617
class SelectBuilder
@@ -85,11 +86,13 @@ public function getJoins()
8586
* Set joins conditions
8687
*
8788
* @param array $joins
88-
* @return void
89+
* @return $this
8990
*/
9091
public function setJoins($joins)
9192
{
9293
$this->joins = $joins;
94+
95+
return $this;
9396
}
9497

9598
/**
@@ -106,11 +109,13 @@ public function getConnectionName()
106109
* Set connection name
107110
*
108111
* @param string $connectionName
109-
* @return void
112+
* @return $this
110113
*/
111114
public function setConnectionName($connectionName)
112115
{
113116
$this->connectionName = $connectionName;
117+
118+
return $this;
114119
}
115120

116121
/**
@@ -127,11 +132,13 @@ public function getColumns()
127132
* Set columns
128133
*
129134
* @param array $columns
130-
* @return void
135+
* @return $this
131136
*/
132137
public function setColumns($columns)
133138
{
134139
$this->columns = $columns;
140+
141+
return $this;
135142
}
136143

137144
/**
@@ -148,11 +155,13 @@ public function getFilters()
148155
* Set filters
149156
*
150157
* @param array $filters
151-
* @return void
158+
* @return $this
152159
*/
153160
public function setFilters($filters)
154161
{
155162
$this->filters = $filters;
163+
164+
return $this;
156165
}
157166

158167
/**
@@ -169,11 +178,13 @@ public function getFrom()
169178
* Set from condition
170179
*
171180
* @param array $from
172-
* @return void
181+
* @return $this
173182
*/
174183
public function setFrom($from)
175184
{
176185
$this->from = $from;
186+
187+
return $this;
177188
}
178189

179190
/**
@@ -236,11 +247,13 @@ public function getGroup()
236247
* Set group
237248
*
238249
* @param array $group
239-
* @return void
250+
* @return $this
240251
*/
241252
public function setGroup($group)
242253
{
243254
$this->group = $group;
255+
256+
return $this;
244257
}
245258

246259
/**
@@ -257,11 +270,13 @@ public function getParams()
257270
* Set parameters
258271
*
259272
* @param array $params
260-
* @return void
273+
* @return $this
261274
*/
262275
public function setParams($params)
263276
{
264277
$this->params = $params;
278+
279+
return $this;
265280
}
266281

267282
/**
@@ -278,10 +293,12 @@ public function getHaving()
278293
* Set having condition
279294
*
280295
* @param array $having
281-
* @return void
296+
* @return $this
282297
*/
283298
public function setHaving($having)
284299
{
285300
$this->having = $having;
301+
302+
return $this;
286303
}
287304
}

app/code/Magento/Analytics/Test/Unit/ReportXml/DB/SelectBuilderTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ public function testCreate()
6464
['link-type' => 'right', 'table' => 'attribute', 'condition' => 'neq'],
6565
];
6666
$groups = ['id', 'name'];
67-
$this->selectBuilder->setConnectionName($connectionName);
68-
$this->selectBuilder->setFrom($from);
69-
$this->selectBuilder->setColumns($columns);
70-
$this->selectBuilder->setFilters([$filter]);
71-
$this->selectBuilder->setJoins($joins);
72-
$this->selectBuilder->setGroup($groups);
67+
$this->selectBuilder->setConnectionName($connectionName)
68+
->setFrom($from)
69+
->setColumns($columns)
70+
->setFilters([$filter])
71+
->setJoins($joins)
72+
->setGroup($groups);
7373
$this->resourceConnectionMock->expects($this->once())
7474
->method('getConnection')
7575
->with($connectionName)

app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
data-validate="{required:true}"
4444
value=""
4545
placeholder="<?= /* @escapeNotVerified */ __('password') ?>"
46-
autocomplete="new-password"
46+
autocomplete="off"
4747
/>
4848
</div>
4949
</div>

app/code/Magento/Bundle/etc/db_schema.xml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@
120120
<table name="catalog_product_bundle_price_index" resource="default" engine="innodb"
121121
comment="Catalog Product Bundle Price Index">
122122
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false"
123-
comment="Entity Id"/>
123+
comment="Entity ID"/>
124124
<column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
125125
comment="Website Id"/>
126126
<column xsi:type="int" name="customer_group_id" padding="10" unsigned="true" nullable="false" identity="false"
127-
comment="Customer Group Id"/>
127+
comment="Customer Group ID"/>
128128
<column xsi:type="decimal" name="min_price" scale="4" precision="12" unsigned="false" nullable="false"
129129
comment="Min Price"/>
130130
<column xsi:type="decimal" name="max_price" scale="4" precision="12" unsigned="false" nullable="false"
@@ -153,11 +153,11 @@
153153
<table name="catalog_product_bundle_stock_index" resource="default" engine="innodb"
154154
comment="Catalog Product Bundle Stock Index">
155155
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false"
156-
comment="Entity Id"/>
156+
comment="Entity ID"/>
157157
<column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
158-
comment="Website Id"/>
158+
comment="Website ID"/>
159159
<column xsi:type="smallint" name="stock_id" padding="5" unsigned="true" nullable="false" identity="false"
160-
comment="Stock Id"/>
160+
comment="Stock ID"/>
161161
<column xsi:type="int" name="option_id" padding="10" unsigned="true" nullable="false" identity="false"
162162
default="0" comment="Option Id"/>
163163
<column xsi:type="smallint" name="stock_status" padding="6" unsigned="false" nullable="true" identity="false"
@@ -172,13 +172,13 @@
172172
<table name="catalog_product_index_price_bundle_idx" resource="default" engine="innodb"
173173
comment="Catalog Product Index Price Bundle Idx">
174174
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false"
175-
comment="Entity Id"/>
175+
comment="Entity ID"/>
176176
<column xsi:type="int" name="customer_group_id" padding="11" unsigned="false" nullable="false"
177177
identity="false"/>
178178
<column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
179-
comment="Website Id"/>
179+
comment="Website ID"/>
180180
<column xsi:type="smallint" name="tax_class_id" padding="5" unsigned="true" nullable="true" identity="false"
181-
default="0" comment="Tax Class Id"/>
181+
default="0" comment="Tax Class ID"/>
182182
<column xsi:type="smallint" name="price_type" padding="5" unsigned="true" nullable="false" identity="false"
183183
comment="Price Type"/>
184184
<column xsi:type="decimal" name="special_price" scale="4" precision="12" unsigned="false" nullable="true"
@@ -206,13 +206,13 @@
206206
<table name="catalog_product_index_price_bundle_tmp" resource="default" engine="memory"
207207
comment="Catalog Product Index Price Bundle Tmp">
208208
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false"
209-
comment="Entity Id"/>
209+
comment="Entity ID"/>
210210
<column xsi:type="int" name="customer_group_id" padding="11" unsigned="false" nullable="false"
211211
identity="false"/>
212212
<column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
213-
comment="Website Id"/>
213+
comment="Website ID"/>
214214
<column xsi:type="smallint" name="tax_class_id" padding="5" unsigned="true" nullable="true" identity="false"
215-
default="0" comment="Tax Class Id"/>
215+
default="0" comment="Tax Class ID"/>
216216
<column xsi:type="smallint" name="price_type" padding="5" unsigned="true" nullable="false" identity="false"
217217
comment="Price Type"/>
218218
<column xsi:type="decimal" name="special_price" scale="4" precision="12" unsigned="false" nullable="true"
@@ -240,11 +240,11 @@
240240
<table name="catalog_product_index_price_bundle_sel_idx" resource="default" engine="innodb"
241241
comment="Catalog Product Index Price Bundle Sel Idx">
242242
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false"
243-
comment="Entity Id"/>
243+
comment="Entity ID"/>
244244
<column xsi:type="int" name="customer_group_id" padding="11" unsigned="false" nullable="false"
245245
identity="false"/>
246246
<column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
247-
comment="Website Id"/>
247+
comment="Website ID"/>
248248
<column xsi:type="int" name="option_id" padding="10" unsigned="true" nullable="false" identity="false"
249249
default="0" comment="Option Id"/>
250250
<column xsi:type="int" name="selection_id" padding="10" unsigned="true" nullable="false" identity="false"
@@ -268,11 +268,11 @@
268268
<table name="catalog_product_index_price_bundle_sel_tmp" resource="default" engine="memory"
269269
comment="Catalog Product Index Price Bundle Sel Tmp">
270270
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false"
271-
comment="Entity Id"/>
271+
comment="Entity ID"/>
272272
<column xsi:type="int" name="customer_group_id" padding="11" unsigned="false" nullable="false"
273273
identity="false"/>
274274
<column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
275-
comment="Website Id"/>
275+
comment="Website ID"/>
276276
<column xsi:type="int" name="option_id" padding="10" unsigned="true" nullable="false" identity="false"
277277
default="0" comment="Option Id"/>
278278
<column xsi:type="int" name="selection_id" padding="10" unsigned="true" nullable="false" identity="false"
@@ -296,11 +296,11 @@
296296
<table name="catalog_product_index_price_bundle_opt_idx" resource="default" engine="innodb"
297297
comment="Catalog Product Index Price Bundle Opt Idx">
298298
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false"
299-
comment="Entity Id"/>
299+
comment="Entity ID"/>
300300
<column xsi:type="int" name="customer_group_id" padding="11" unsigned="false" nullable="false"
301301
identity="false"/>
302302
<column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
303-
comment="Website Id"/>
303+
comment="Website ID"/>
304304
<column xsi:type="int" name="option_id" padding="10" unsigned="true" nullable="false" identity="false"
305305
default="0" comment="Option Id"/>
306306
<column xsi:type="decimal" name="min_price" scale="4" precision="12" unsigned="false" nullable="true"
@@ -323,11 +323,11 @@
323323
<table name="catalog_product_index_price_bundle_opt_tmp" resource="default" engine="memory"
324324
comment="Catalog Product Index Price Bundle Opt Tmp">
325325
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false"
326-
comment="Entity Id"/>
326+
comment="Entity ID"/>
327327
<column xsi:type="int" name="customer_group_id" padding="11" unsigned="false" nullable="false"
328328
identity="false"/>
329329
<column xsi:type="smallint" name="website_id" padding="5" unsigned="true" nullable="false" identity="false"
330-
comment="Website Id"/>
330+
comment="Website ID"/>
331331
<column xsi:type="int" name="option_id" padding="10" unsigned="true" nullable="false" identity="false"
332332
default="0" comment="Option Id"/>
333333
<column xsi:type="decimal" name="min_price" scale="4" precision="12" unsigned="false" nullable="true"

app/code/Magento/Catalog/Model/ProductLink/CollectionProvider.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
use Magento\Catalog\Model\ProductLink\Converter\ConverterPool;
1010
use Magento\Framework\Exception\NoSuchEntityException;
1111

12+
/**
13+
* Provides a collection of linked product items (crosssells, related, upsells, ...)
14+
*/
1215
class CollectionProvider
1316
{
1417
/**
@@ -47,22 +50,20 @@ public function getCollection(\Magento\Catalog\Model\Product $product, $type)
4750

4851
$products = $this->providers[$type]->getLinkedProducts($product);
4952
$converter = $this->converterPool->getConverter($type);
50-
$output = [];
5153
$sorterItems = [];
5254
foreach ($products as $item) {
53-
$output[$item->getId()] = $converter->convert($item);
55+
$itemId = $item->getId();
56+
$sorterItems[$itemId] = $converter->convert($item);
57+
$sorterItems[$itemId]['position'] = $sorterItems[$itemId]['position'] ?? 0;
5458
}
5559

56-
foreach ($output as $item) {
57-
$itemPosition = $item['position'];
58-
if (!isset($sorterItems[$itemPosition])) {
59-
$sorterItems[$itemPosition] = $item;
60-
} else {
61-
$newPosition = $itemPosition + 1;
62-
$sorterItems[$newPosition] = $item;
63-
}
64-
}
65-
ksort($sorterItems);
60+
usort($sorterItems, function ($itemA, $itemB) {
61+
$posA = intval($itemA['position']);
62+
$posB = intval($itemB['position']);
63+
64+
return $posA <=> $posB;
65+
});
66+
6667
return $sorterItems;
6768
}
6869
}

app/code/Magento/Catalog/Test/Unit/Model/CollectionProviderTest.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,14 @@ public function testGetCollection()
5757
$linkedProductOneMock = $this->createMock(Product::class);
5858
$linkedProductTwoMock = $this->createMock(Product::class);
5959
$linkedProductThreeMock = $this->createMock(Product::class);
60+
$linkedProductFourMock = $this->createMock(Product::class);
61+
$linkedProductFiveMock = $this->createMock(Product::class);
6062

6163
$linkedProductOneMock->expects($this->once())->method('getId')->willReturn(1);
6264
$linkedProductTwoMock->expects($this->once())->method('getId')->willReturn(2);
6365
$linkedProductThreeMock->expects($this->once())->method('getId')->willReturn(3);
66+
$linkedProductFourMock->expects($this->once())->method('getId')->willReturn(4);
67+
$linkedProductFiveMock->expects($this->once())->method('getId')->willReturn(5);
6468

6569
$this->converterPoolMock->expects($this->once())
6670
->method('getConverter')
@@ -71,9 +75,11 @@ public function testGetCollection()
7175
[$linkedProductOneMock, ['name' => 'Product One', 'position' => 10]],
7276
[$linkedProductTwoMock, ['name' => 'Product Two', 'position' => 2]],
7377
[$linkedProductThreeMock, ['name' => 'Product Three', 'position' => 2]],
78+
[$linkedProductFourMock, ['name' => 'Product Four', 'position' => null]],
79+
[$linkedProductFiveMock, ['name' => 'Product Five']],
7480
];
7581

76-
$this->converterMock->expects($this->exactly(3))->method('convert')->willReturnMap($map);
82+
$this->converterMock->expects($this->exactly(5))->method('convert')->willReturnMap($map);
7783

7884
$this->providerMock->expects($this->once())
7985
->method('getLinkedProducts')
@@ -82,14 +88,18 @@ public function testGetCollection()
8288
[
8389
$linkedProductOneMock,
8490
$linkedProductTwoMock,
85-
$linkedProductThreeMock
91+
$linkedProductThreeMock,
92+
$linkedProductFourMock,
93+
$linkedProductFiveMock,
8694
]
8795
);
8896

8997
$expectedResult = [
90-
2 => ['name' => 'Product Two', 'position' => 2],
91-
3 => ['name' => 'Product Three', 'position' => 2],
92-
10 => ['name' => 'Product One', 'position' => 10],
98+
0 => ['name' => 'Product Four', 'position' => 0],
99+
1 => ['name' => 'Product Five', 'position' => 0],
100+
2 => ['name' => 'Product Three', 'position' => 2],
101+
3 => ['name' => 'Product Two', 'position' => 2],
102+
4 => ['name' => 'Product One', 'position' => 10],
93103
];
94104

95105
$actualResult = $this->model->getCollection($this->productMock, 'crosssell');

0 commit comments

Comments
 (0)