Skip to content

Commit f35cd0a

Browse files
committed
Merge remote-tracking branch 'mainline/develop' into falcons-pr-bugfixes
2 parents fefb1d7 + c350871 commit f35cd0a

File tree

24 files changed

+178
-69
lines changed

24 files changed

+178
-69
lines changed

app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,16 @@ public function getGridIdsJson()
275275
if (!$this->getUseSelectAll()) {
276276
return '';
277277
}
278-
279278
/** @var \Magento\Framework\Data\Collection $allIdsCollection */
280279
$allIdsCollection = clone $this->getParentBlock()->getCollection();
281-
$gridIds = $allIdsCollection->clear()->setPageSize(0)->getAllIds();
282-
280+
281+
if ($this->getMassactionIdField()) {
282+
$massActionIdField = $this->getMassactionIdField();
283+
} else {
284+
$massActionIdField = $this->getParentBlock()->getMassactionIdField();
285+
}
286+
287+
$gridIds = $allIdsCollection->setPageSize(0)->getColumnValues($massActionIdField);
283288
if (!empty($gridIds)) {
284289
return join(",", $gridIds);
285290
}

app/code/Magento/Backend/Block/Widget/Grid/Massaction/Extended.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,14 @@ public function getGridIdsJson()
274274

275275
/** @var \Magento\Framework\Data\Collection $allIdsCollection */
276276
$allIdsCollection = clone $this->getParentBlock()->getCollection();
277-
$gridIds = $allIdsCollection->clear()->setPageSize(0)->getAllIds();
277+
278+
if ($this->getMassactionIdField()) {
279+
$massActionIdField = $this->getMassactionIdField();
280+
} else {
281+
$massActionIdField = $this->getParentBlock()->getMassactionIdField();
282+
}
283+
284+
$gridIds = $allIdsCollection->setPageSize(0)->getColumnValues($massActionIdField);
278285

279286
if (!empty($gridIds)) {
280287
return join(",", $gridIds);

app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Massaction/ExtendedTest.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,13 @@ public function testGetGridIdsJsonWithoutUseSelectAll()
132132
public function testGetGridIdsJsonWithUseSelectAll(array $items, $result)
133133
{
134134
$this->_block->setUseSelectAll(true);
135-
135+
136+
if ($this->_block->getMassactionIdField()) {
137+
$massActionIdField = $this->_block->getMassactionIdField();
138+
} else {
139+
$massActionIdField = $this->_block->getParentBlock()->getMassactionIdField();
140+
}
141+
136142
$collectionMock = $this->getMockBuilder(\Magento\Framework\Data\Collection::class)
137143
->disableOriginalConstructor()
138144
->getMock();
@@ -141,15 +147,13 @@ public function testGetGridIdsJsonWithUseSelectAll(array $items, $result)
141147
->method('getCollection')
142148
->willReturn($collectionMock);
143149

144-
$collectionMock->expects($this->once())
145-
->method('clear')
146-
->willReturnSelf();
147150
$collectionMock->expects($this->once())
148151
->method('setPageSize')
149152
->with(0)
150153
->willReturnSelf();
151154
$collectionMock->expects($this->once())
152-
->method('getAllIds')
155+
->method('getColumnValues')
156+
->with($massActionIdField)
153157
->willReturn($items);
154158

155159
$this->assertEquals($result, $this->_block->getGridIdsJson());

app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/MassactionTest.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,12 @@ public function testGetGridIdsJsonWithoutUseSelectAll()
237237
public function testGetGridIdsJsonWithUseSelectAll(array $items, $result)
238238
{
239239
$this->_block->setUseSelectAll(true);
240+
241+
if ($this->_block->getMassactionIdField()) {
242+
$massActionIdField = $this->_block->getMassactionIdField();
243+
} else {
244+
$massActionIdField = $this->_block->getParentBlock()->getMassactionIdField();
245+
}
240246

241247
$collectionMock = $this->getMockBuilder(\Magento\Framework\Data\Collection::class)
242248
->disableOriginalConstructor()
@@ -245,16 +251,13 @@ public function testGetGridIdsJsonWithUseSelectAll(array $items, $result)
245251
$this->_gridMock->expects($this->once())
246252
->method('getCollection')
247253
->willReturn($collectionMock);
248-
249-
$collectionMock->expects($this->once())
250-
->method('clear')
251-
->willReturnSelf();
252254
$collectionMock->expects($this->once())
253255
->method('setPageSize')
254256
->with(0)
255257
->willReturnSelf();
256258
$collectionMock->expects($this->once())
257-
->method('getAllIds')
259+
->method('getColumnValues')
260+
->with($massActionIdField)
258261
->willReturn($items);
259262

260263
$this->assertEquals($result, $this->_block->getGridIdsJson());

app/code/Magento/Catalog/Block/Product/AbstractProduct.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ class AbstractProduct extends \Magento\Framework\View\Element\Template
9696
*/
9797
protected $stockRegistry;
9898

99+
/**
100+
* @var ImageBuilder
101+
*/
102+
protected $imageBuilder;
103+
99104
/**
100105
* @param Context $context
101106
* @param array $data

app/code/Magento/Catalog/Model/Product/Option/Validator/Select.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ protected function isValidOptionPrice($priceType, $price, $storeId)
8080
if ($storeId > \Magento\Store\Model\Store::DEFAULT_STORE_ID && $priceType === null && $price === null) {
8181
return true;
8282
}
83+
if (!$priceType && !$price) {
84+
return true;
85+
}
8386
if (!$this->isInRange($priceType, $this->priceTypes) || $this->isNegative($price)) {
8487
return false;
8588
}

app/code/Magento/Catalog/Test/Unit/Model/Product/Option/Validator/SelectTest.php

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,40 +54,45 @@ protected function setUp()
5454
}
5555

5656
/**
57+
* @param bool $expectedResult
5758
* @param array $value
5859
* @dataProvider isValidSuccessDataProvider
5960
*/
60-
public function testIsValidSuccess($value)
61+
public function testIsValidSuccess($expectedResult, array $value)
6162
{
62-
$value = [
63-
'price_type' => 'fixed',
64-
'price' => '10',
65-
'title' => 'Some Title',
66-
];
6763
$this->valueMock->expects($this->once())->method('getTitle')->will($this->returnValue('option_title'));
6864
$this->valueMock->expects($this->exactly(2))->method('getType')->will($this->returnValue('name 1.1'));
6965
$this->valueMock->expects($this->never())->method('getPriceType');
7066
$this->valueMock->expects($this->never())->method('getPrice');
7167
$this->valueMock->expects($this->any())->method('getData')->with('values')->will($this->returnValue([$value]));
72-
$this->assertTrue($this->validator->isValid($this->valueMock));
73-
$this->assertEmpty($this->validator->getMessages());
68+
$this->assertEquals($expectedResult, $this->validator->isValid($this->valueMock));
7469
}
7570

7671
public function isValidSuccessDataProvider()
7772
{
78-
$value = [
79-
'price_type' => 'fixed',
80-
'price' => '10',
81-
'title' => 'Some Title',
82-
];
83-
84-
$valueWithoutAllData = [
85-
'some_data' => 'data',
86-
];
87-
8873
return [
89-
'all_data' => [$value],
90-
'not_all_data' => [$valueWithoutAllData]
74+
[
75+
true,
76+
[
77+
'price_type' => 'fixed',
78+
'price' => '10',
79+
'title' => 'Some Title',
80+
]
81+
],
82+
[
83+
true,
84+
[
85+
'title' => 'Some Title',
86+
]
87+
],
88+
[
89+
false,
90+
[
91+
'title' => 'Some Title',
92+
'price_type' => 'fixed',
93+
'price' => -10,
94+
]
95+
],
9196
];
9297
}
9398

app/code/Magento/Paypal/Model/Api/ProcessableException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ProcessableException extends LocalizedException
4040
*/
4141
public function __construct(Phrase $phrase, \Exception $cause = null, $code = 0)
4242
{
43-
parent::__construct($phrase, $cause);
43+
parent::__construct($phrase, $cause, $code);
4444
$this->code = $code;
4545
}
4646

app/code/Magento/Search/Model/Synonym/MergeConflictException.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ class MergeConflictException extends LocalizedException
2828
* @param array $conflictingSynonyms
2929
* @param Phrase|null $phrase
3030
* @param \Exception|null $cause
31+
* @param int $code
3132
*/
32-
public function __construct(array $conflictingSynonyms, Phrase $phrase = null, \Exception $cause = null)
33+
public function __construct(array $conflictingSynonyms, Phrase $phrase = null, \Exception $cause = null, $code = 0)
3334
{
34-
parent::__construct($phrase, $cause);
35+
parent::__construct($phrase, $cause, $code);
3536
$this->conflictingSynonyms = $conflictingSynonyms;
3637
}
3738

app/code/Magento/Store/Model/StoreIsInactiveException.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ class StoreIsInactiveException extends LocalizedException
1616
/**
1717
* @param \Magento\Framework\Phrase $phrase
1818
* @param \Exception $cause
19+
* @param int $code
1920
*/
20-
public function __construct(Phrase $phrase = null, \Exception $cause = null)
21+
public function __construct(Phrase $phrase = null, \Exception $cause = null, $code = 0)
2122
{
2223
if ($phrase === null) {
2324
$phrase = new Phrase('Store is inactive');
2425
}
25-
parent::__construct($phrase, $cause);
26+
parent::__construct($phrase, $cause, $code);
2627
}
2728
}

0 commit comments

Comments
 (0)