Skip to content

Commit c132f78

Browse files
committed
Merge branch 'develop' of https://github.com/magento/magento2ce into MPI-PR-develop
2 parents 159b1b9 + 4ecd6e8 commit c132f78

File tree

55 files changed

+1580
-313
lines changed

Some content is hidden

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

55 files changed

+1580
-313
lines changed

.htaccess

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
DirectoryIndex index.php
3434

35+
<IfModule mod_php5.c>
3536
############################################
3637
## adjust memory limit
3738

@@ -53,7 +54,30 @@
5354
## disable user agent verification to not break multiple image upload
5455

5556
php_flag suhosin.session.cryptua off
57+
</IfModule>
58+
<IfModule mod_php7.c>
59+
############################################
60+
## adjust memory limit
61+
62+
php_value memory_limit 768M
63+
php_value max_execution_time 18000
64+
65+
############################################
66+
## disable automatic session start
67+
## before autoload was initialized
68+
69+
php_flag session.auto_start off
70+
71+
############################################
72+
## enable resulting html compression
73+
74+
#php_flag zlib.output_compression on
5675

76+
###########################################
77+
## disable user agent verification to not break multiple image upload
78+
79+
php_flag suhosin.session.cryptua off
80+
</IfModule>
5781
<IfModule mod_security.c>
5882
###########################################
5983
## disable POST processing to not break multiple image upload

.user.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
memory_limit = 768M
2+
max_execution_time = 18000
3+
session.auto_start = off
4+
suhosin.session.cryptua = off

app/code/Magento/Backend/Block/Store/Switcher.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
/**
1010
* Store switcher block
11-
*
12-
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1311
*/
1412
class Switcher extends \Magento\Backend\Block\Template
1513
{
@@ -152,11 +150,7 @@ public function getWebsites()
152150
{
153151
$websites = $this->_storeManager->getWebsites();
154152
if ($websiteIds = $this->getWebsiteIds()) {
155-
foreach (array_keys($websites) as $websiteId) {
156-
if (!in_array($websiteId, $websiteIds)) {
157-
unset($websites[$websiteId]);
158-
}
159-
}
153+
$websites = array_intersect_key($websites, array_flip($websiteIds));
160154
}
161155
return $websites;
162156
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Backend\Test\Unit\Block\Store;
8+
9+
class SwitcherTest extends \PHPUnit_Framework_TestCase
10+
{
11+
/**
12+
* @var \Magento\Backend\Block\Store\Switcher
13+
*/
14+
private $switcherBlock;
15+
16+
private $storeManagerMock;
17+
18+
protected function setUp()
19+
{
20+
$this->storeManagerMock = $this->getMock(\Magento\Store\Model\StoreManagerInterface::class);
21+
$objectHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
22+
$context = $objectHelper->getObject(
23+
\Magento\Backend\Block\Template\Context::class,
24+
[
25+
'storeManager' => $this->storeManagerMock,
26+
]
27+
);
28+
29+
$this->switcherBlock = $objectHelper->getObject(
30+
\Magento\Backend\Block\Store\Switcher::class,
31+
['context' => $context]
32+
);
33+
}
34+
35+
public function testGetWebsites()
36+
{
37+
$websiteMock = $this->getMock(\Magento\Store\Model\Website::class, [], [], '', false);
38+
$websites = [0 => $websiteMock, 1 => $websiteMock];
39+
$this->storeManagerMock->expects($this->once())->method('getWebsites')->will($this->returnValue($websites));
40+
$this->assertEquals($websites, $this->switcherBlock->getWebsites());
41+
}
42+
43+
public function testGetWebsitesIfSetWebsiteIds()
44+
{
45+
$websiteMock = $this->getMock(\Magento\Store\Model\Website::class, [], [], '', false);
46+
$websites = [0 => $websiteMock, 1 => $websiteMock];
47+
$this->storeManagerMock->expects($this->once())->method('getWebsites')->will($this->returnValue($websites));
48+
49+
$this->switcherBlock->setWebsiteIds([1]);
50+
$expected = [1 => $websiteMock];
51+
$this->assertEquals($expected, $this->switcherBlock->getWebsites());
52+
}
53+
}

app/code/Magento/Backend/view/adminhtml/web/template/dynamic-rows/grid.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
</label>
3535

3636
<div class="admin__field-control" data-role="grid-wrapper">
37-
<div class="admin__control-table-pagination" visible="!!$data.recordData().length">
37+
<div class="admin__control-table-pagination" visible="!!element.getRecordCount()">
3838
<div class="admin__data-grid-pager">
3939
<button class="action-previous" type="button" data-bind="attr: {title: $t('Previous Page')}, click: previousPage, disable: isFirst()"></button>
4040
<input class="admin__control-text" type="number" data-bind="attr: {id: ++ko.uid}, value: currentPage">
@@ -51,10 +51,10 @@
5151

5252
<th repeat="foreach: labels, item: '$label'"
5353
class="data-grid-th"
54-
translate="$label().label"
5554
visible="$label().visible"
5655
disable="$label().disabled"
5756
css="setClasses($label())">
57+
<span translate="$label().label"/>
5858
</th>
5959
</tr>
6060
</thead>

app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,7 @@ protected function getBundleOptions()
342342
'selection_price_value' => '',
343343
'selection_qty' => '',
344344
],
345-
'links' => [
346-
'insertData' => '${ $.provider }:${ $.dataProvider }'
347-
],
345+
'links' => ['insertData' => '${ $.provider }:${ $.dataProvider }'],
348346
'source' => 'product',
349347
'addButton' => false,
350348
],
@@ -588,10 +586,7 @@ protected function getBundleSelections()
588586
'prefer' => 'radio',
589587
'value' => '0',
590588
'sortOrder' => 50,
591-
'valueMap' => [
592-
'false' => '0',
593-
'true' => '1'
594-
]
589+
'valueMap' => ['false' => '0', 'true' => '1']
595590
],
596591
],
597592
],
@@ -642,7 +637,8 @@ protected function getBundleSelections()
642637
'sortOrder' => 100,
643638
'validation' => [
644639
'required-entry' => true,
645-
'validate-zero-or-greater' => true
640+
'validate-number' => true,
641+
'validate-greater-than-zero' => true
646642
],
647643
'imports' => [
648644
'isInteger' => '${ $.provider }:${ $.parentScope }.selection_qty_is_integer'

app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/Composite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function modifyData(array $data)
120120
'is_default' => ($productLink->getIsDefault()) ? '1' : '0',
121121
'selection_price_value' => $productLink->getPrice(),
122122
'selection_price_type' => $productLink->getPriceType(),
123-
'selection_qty' => (bool)$integerQty ? (int)$productLink->getQty() : $productLink->getQty(),
123+
'selection_qty' => $integerQty ? (int)$productLink->getQty() : $productLink->getQty(),
124124
'selection_can_change_qty' => $productLink->getCanChangeQuantity(),
125125
'selection_qty_is_integer' => (bool)$integerQty,
126126
'position' => $productLink->getPosition(),

app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-option-qty.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,28 @@ define([
1111
return Abstract.extend({
1212
defaults: {
1313
valueUpdate: 'input',
14-
isInteger: true
14+
isInteger: true,
15+
validation: {
16+
'validate-number': true
17+
}
1518
},
1619

1720
/**
18-
* update event
21+
* @inheritdoc
1922
*/
2023
onUpdate: function () {
21-
this.validation['validate-number'] = true;
2224
this.validation['validate-digits'] = this.isInteger;
23-
this.validate();
25+
this._super();
26+
},
27+
28+
/**
29+
* @inheritdoc
30+
*/
31+
hasChanged: function () {
32+
var notEqual = this.value() !== this.initialValue.toString();
33+
34+
return !this.visible() ? false : notEqual;
2435
}
36+
2537
});
2638
});

app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ class Content extends \Magento\Backend\Block\Widget
4040
*/
4141
private $imageHelper;
4242

43-
/**
44-
* @var \Magento\Framework\View\Asset\Repository
45-
*/
46-
private $assetRepo;
47-
4843
/**
4944
* @param \Magento\Backend\Block\Template\Context $context
5045
* @param \Magento\Framework\Json\EncoderInterface $jsonEncoder
@@ -147,13 +142,8 @@ public function getImagesJson()
147142
$fileHandler = $mediaDir->stat($this->_mediaConfig->getMediaPath($image['file']));
148143
$image['size'] = $fileHandler['size'];
149144
} catch (FileSystemException $e) {
150-
$staticDir = $this->_filesystem->getDirectoryRead(DirectoryList::STATIC_VIEW);
151-
$image['url'] = $this->getImageHelper()->getDefaultPlaceholderUrl('thumbnail');
152-
$fileHandler = $staticDir->stat(
153-
$this->getAssetRepo()
154-
->createAsset($this->getImageHelper()->getPlaceholder('thumbnail'))->getPath()
155-
);
156-
$image['size'] = $fileHandler['size'];
145+
$image['url'] = $this->getImageHelper()->getDefaultPlaceholderUrl('small_image');
146+
$image['size'] = 0;
157147
$this->_logger->warning($e);
158148
}
159149
}
@@ -262,18 +252,4 @@ private function getImageHelper()
262252
}
263253
return $this->imageHelper;
264254
}
265-
266-
/**
267-
* @return \Magento\Framework\View\Asset\Repository
268-
* @deprecated
269-
*/
270-
private function getAssetRepo()
271-
{
272-
if ($this->assetRepo === null) {
273-
$this->assetRepo = \Magento\Framework\App\ObjectManager::getInstance()
274-
->get(\Magento\Framework\View\Asset\Repository::class);
275-
}
276-
277-
return $this->assetRepo;
278-
}
279255
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ public function update($sku, ProductAttributeMediaGalleryEntryInterface $entry)
9696
foreach ($existingMediaGalleryEntries as $key => $existingEntry) {
9797
if ($existingEntry->getId() == $entry->getId()) {
9898
$found = true;
99+
if ($entry->getFile()) {
100+
$entry->setId(null);
101+
}
99102
$existingMediaGalleryEntries[$key] = $entry;
100103
break;
101104
}

app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Helper/Form/Gallery/ContentTest.php

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@ class ContentTest extends \PHPUnit_Framework_TestCase
4646
*/
4747
protected $imageHelper;
4848

49-
/**
50-
* @var \Magento\Framework\View\Asset\Repository|\PHPUnit_Framework_MockObject_MockObject
51-
*/
52-
protected $assetRepo;
53-
5449
/**
5550
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
5651
*/
@@ -171,12 +166,7 @@ public function testGetImagesJsonWithException()
171166
{
172167
$this->imageHelper = $this->getMockBuilder(\Magento\Catalog\Helper\Image::class)
173168
->disableOriginalConstructor()
174-
->setMethods(['getDefaultPlaceholderUrl', 'getPlaceholder'])
175-
->getMock();
176-
177-
$this->assetRepo = $this->getMockBuilder(\Magento\Framework\View\Asset\Repository::class)
178-
->disableOriginalConstructor()
179-
->setMethods(['createAsset', 'getPath'])
169+
->setMethods(['getDefaultPlaceholderUrl'])
180170
->getMock();
181171

182172
$this->objectManager->setBackwardCompatibleProperty(
@@ -185,32 +175,24 @@ public function testGetImagesJsonWithException()
185175
$this->imageHelper
186176
);
187177

188-
$this->objectManager->setBackwardCompatibleProperty(
189-
$this->content,
190-
'assetRepo',
191-
$this->assetRepo
192-
);
193-
194178
$placeholderUrl = 'url_to_the_placeholder/placeholder.jpg';
195179

196-
$sizePlaceholder = ['size' => 399659];
197-
198180
$imagesResult = [
199181
[
200182
'value_id' => '2',
201183
'file' => 'file_2.jpg',
202184
'media_type' => 'image',
203185
'position' => '0',
204186
'url' => 'url_to_the_placeholder/placeholder.jpg',
205-
'size' => 399659
187+
'size' => 0
206188
],
207189
[
208190
'value_id' => '1',
209191
'file' => 'file_1.jpg',
210192
'media_type' => 'image',
211193
'position' => '1',
212194
'url' => 'url_to_the_placeholder/placeholder.jpg',
213-
'size' => 399659
195+
'size' => 0
214196
]
215197
];
216198

@@ -238,18 +220,13 @@ public function testGetImagesJsonWithException()
238220
$this->mediaConfigMock->expects($this->any())->method('getMediaPath');
239221
$this->readMock->expects($this->any())->method('stat')->willReturnOnConsecutiveCalls(
240222
$this->throwException(
241-
new \Magento\Framework\Exception\FileSystemException(new \Magento\Framework\Phrase('test'))
223+
new \Magento\Framework\Exception\FileSystemException(new Phrase('test'))
242224
),
243-
$sizePlaceholder,
244225
$this->throwException(
245-
new \Magento\Framework\Exception\FileSystemException(new \Magento\Framework\Phrase('test'))
246-
),
247-
$sizePlaceholder
226+
new \Magento\Framework\Exception\FileSystemException(new Phrase('test'))
227+
)
248228
);
249229
$this->imageHelper->expects($this->any())->method('getDefaultPlaceholderUrl')->willReturn($placeholderUrl);
250-
$this->imageHelper->expects($this->any())->method('getPlaceholder');
251-
$this->assetRepo->expects($this->any())->method('createAsset')->willReturnSelf();
252-
$this->assetRepo->expects($this->any())->method('getPath');
253230
$this->jsonEncoderMock->expects($this->once())->method('encode')->willReturnCallback('json_encode');
254231

255232
$this->assertSame(json_encode($imagesResult), $this->content->getImagesJson());

0 commit comments

Comments
 (0)