Skip to content

Commit 19ecf05

Browse files
author
Dmytro Voskoboinikov
committed
Merge branch 'develop' into MAGETWO-64547
2 parents ea053ca + c350871 commit 19ecf05

File tree

91 files changed

+2802
-359
lines changed

Some content is hidden

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

91 files changed

+2802
-359
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/Config/Model/Config/Backend/Admin/Robots.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Magento\Framework\App\ObjectManager;
1414

1515
/**
16-
* @api
16+
* @deprecated robots.txt file is no longer stored in filesystem. It generates as response on request.
1717
*/
1818
class Robots extends \Magento\Framework\App\Config\Value
1919
{

app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/summary.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,15 @@ define([
9191
var productSku = this.variationsComponent().getProductValue('sku'),
9292
productPrice = this.variationsComponent().getProductPrice(),
9393
productWeight = this.variationsComponent().getProductValue('weight'),
94+
productName = this.variationsComponent().getProductValue('name'),
9495
variationsKeys = [],
9596
gridExisting = [],
9697
gridNew = [],
9798
gridDeleted = [];
9899

99100
this.variations = [];
100101
_.each(variations, function (options) {
101-
var product, images, sku, quantity, price, variation,
102+
var product, images, sku, name, quantity, price, variation,
102103
productId = this.variationsComponent().getProductIdByOptions(options);
103104

104105
if (productId) {
@@ -110,6 +111,9 @@ define([
110111
sku = productSku + _.reduce(options, function (memo, option) {
111112
return memo + '-' + option.label;
112113
}, '');
114+
name = productName + _.reduce(options, function (memo, option) {
115+
return memo + '-' + option.label;
116+
}, '');
113117
quantity = getSectionValue('quantity', options);
114118

115119
if (!quantity && productId) {
@@ -128,7 +132,7 @@ define([
128132
options: options,
129133
images: images,
130134
sku: sku,
131-
name: sku,
135+
name: name,
132136
quantity: quantity,
133137
price: price,
134138
productId: productId,
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Customer\Block;
7+
8+
/**
9+
* Class CustomerScopeData provide scope (website, store or store_group) information on front
10+
* Can be used, for example, on store front, in order to determine
11+
* that private cache invalid for current scope, by comparing
12+
* with appropriate value in store front private cache.
13+
* @api
14+
*/
15+
class CustomerScopeData extends \Magento\Framework\View\Element\Template
16+
{
17+
/**
18+
* @var \Magento\Framework\View\Element\Template\Context
19+
*/
20+
private $storeManager;
21+
22+
/**
23+
* @var \Magento\Framework\Json\EncoderInterface
24+
*/
25+
private $jsonEncoder;
26+
27+
/**
28+
* @param \Magento\Framework\View\Element\Template\Context $context
29+
* @param \Magento\Framework\Json\EncoderInterface $jsonEncoder
30+
* @param array $data
31+
*/
32+
public function __construct(
33+
\Magento\Framework\View\Element\Template\Context $context,
34+
\Magento\Framework\Json\EncoderInterface $jsonEncoder,
35+
array $data = []
36+
) {
37+
parent::__construct($context, $data);
38+
$this->storeManager = $context->getStoreManager();
39+
$this->jsonEncoder = $jsonEncoder;
40+
}
41+
42+
/**
43+
* Return id of current website
44+
*
45+
* Can be used when necessary to obtain website id of the current customer.
46+
*
47+
* @return integer
48+
*/
49+
public function getWebsiteId()
50+
{
51+
return (int)$this->_storeManager->getStore()->getWebsiteId();
52+
}
53+
}

0 commit comments

Comments
 (0)