Skip to content

Commit 9a742af

Browse files
committed
Merge remote-tracking branch 'magento-ce/develop' into MAGETWO-54708-PR
2 parents acd163d + c350871 commit 9a742af

File tree

80 files changed

+2431
-93
lines changed

Some content is hidden

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

80 files changed

+2431
-93
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
{
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+
}

app/code/Magento/Customer/CustomerData/Customer.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ class Customer implements SectionSourceInterface
1919
*/
2020
protected $currentCustomer;
2121

22+
/**
23+
* @var View
24+
*/
25+
private $customerViewHelper;
26+
2227
/**
2328
* @param CurrentCustomer $currentCustomer
2429
* @param View $customerViewHelper
@@ -39,10 +44,12 @@ public function getSectionData()
3944
if (!$this->currentCustomer->getCustomerId()) {
4045
return [];
4146
}
47+
4248
$customer = $this->currentCustomer->getCustomer();
4349
return [
4450
'fullname' => $this->customerViewHelper->getCustomerName($customer),
4551
'firstname' => $customer->getFirstname(),
52+
'websiteId' => $customer->getWebsiteId(),
4653
];
4754
}
4855
}

0 commit comments

Comments
 (0)