Skip to content

Commit 6e6bad7

Browse files
committed
Merge remote-tracking branch 'vanilla/develop' into MAGETWO-32170--JS-51
2 parents 602094d + 9ae5bba commit 6e6bad7

File tree

49 files changed

+1616
-364
lines changed

Some content is hidden

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

49 files changed

+1616
-364
lines changed

app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset/element.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
$element = $block->getElement();
1313
$note = $element->getNote() ? '<div class="note" id="' . $element->getId() . '-note">' . $element->getNote() . '</div>' : '';
1414
$elementBeforeLabel = $element->getExtType() == 'checkbox admin__control-checkbox' || $element->getExtType() == 'radio admin__control-radio';
15-
$addOn = $element->getBeforeElementHtml() || $element->getAfterElementHtml();
15+
$addOn = ($element->getBeforeElementHtml() || $element->getAfterElementHtml()) && !$element->getNoWrapAsAddon();
1616
$fieldId = ($element->getHtmlContainerId()) ? ' id="' . $element->getHtmlContainerId() . '"' : '';
1717
$fieldClass = "admin__field field field-{$element->getId()} {$element->getCssClass()}";
1818
$fieldClass .= ($elementBeforeLabel) ? ' choice' : '';

app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_set_edit.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
99
<body>
1010
<referenceContainer name="content">
11-
<block class="Magento\Catalog\Block\Adminhtml\Product\Attribute\Set\Main" name="adminhtml.catalog.product.set.edit" template="catalog/product/attribute/set/main.phtml"/>
11+
<container name="adminhtml.catalog.product.set.edit.wrapper" htmlTag="div" htmlClass="admin__scope-old"><!-- @todo ui: remove arguments within .admin__scope-old -->
12+
<block class="Magento\Catalog\Block\Adminhtml\Product\Attribute\Set\Main" name="adminhtml.catalog.product.set.edit" template="catalog/product/attribute/set/main.phtml"/>
13+
</container>
1214
</referenceContainer>
1315
</body>
1416
</page>

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1803,7 +1803,7 @@ protected function _saveMediaGallery(array $mediaGalleryData)
18031803
'value' => $insertValue['value'],
18041804
];
18051805
$valueToProductId[$insertValue['value']] = $productId;
1806-
$imageNames = $insertValue['value'];
1806+
$imageNames[] = $insertValue['value'];
18071807
$multiInsertData[] = $valueArr;
18081808
$insertedGalleryImgs[] = $insertValue['value'];
18091809
}

app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/attribute/steps/bulk.phtml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,6 @@
225225
</div>
226226
</fieldset>
227227
</div>
228-
229-
<button type="button"
230-
class="action-close"
231-
data-role="close-panel"
232-
title="<?= $block->escapeHtml(__('Close panel')) ?>">
233-
<span><?= /* @escapeNotVerified */ __('Close panel') ?></span>
234-
</button>
235-
<div class="image-pointer"></div>
236228
</div>
237229
</script>
238230

@@ -441,14 +433,6 @@
441433
</div>
442434
</fieldset>
443435
</div>
444-
445-
<button type="button"
446-
class="action-close"
447-
data-role="close-panel"
448-
title="<?= $block->escapeHtml(__('Close panel')) ?>">
449-
<span><?= /* @escapeNotVerified */ __('Close panel') ?></span>
450-
</button>
451-
<div class="image-pointer"></div>
452436
</div>
453437
</script>
454438

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

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,14 @@
77

88
class CustomerData extends \Magento\Framework\View\Element\Template
99
{
10-
/**
11-
* Sections that can not be cached on frontend-side
12-
*
13-
* @var array
14-
*/
15-
protected $nonCachedSections = [];
16-
1710
/**
1811
* @param \Magento\Framework\View\Element\Template\Context $context
1912
* @param array $data
20-
* @param array $nonCachedSections
2113
*/
2214
public function __construct(
2315
\Magento\Framework\View\Element\Template\Context $context,
24-
array $data = [],
25-
array $nonCachedSections = []
16+
array $data = []
2617
) {
27-
$this->nonCachedSections = $nonCachedSections;
2818
parent::__construct($context, $data);
2919
}
3020

@@ -50,24 +40,4 @@ public function getCustomerDataUrl($route)
5040
{
5141
return $this->getUrl($route, ['_secure' => $this->getRequest()->isSecure()]);
5242
}
53-
54-
/**
55-
* Get sections that can not be cached on frontend-side
56-
*
57-
* @return array
58-
*/
59-
public function getNotCachedSections()
60-
{
61-
return $this->nonCachedSections;
62-
}
63-
64-
/**
65-
* Get keys of sections that can not be cached on frontend-side
66-
*
67-
* @return array
68-
*/
69-
public function getNonCachedSectionKeys()
70-
{
71-
return array_keys($this->nonCachedSections);
72-
}
7343
}
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Customer\Test\Unit\Ui\Component;
7+
8+
use Magento\Customer\Api\Data\AttributeMetadataInterface;
9+
use Magento\Customer\Ui\Component\DataProvider;
10+
use Magento\Customer\Ui\Component\Listing\AttributeRepository;
11+
use Magento\Framework\Api\FilterBuilder;
12+
use Magento\Framework\Api\Search\SearchCriteriaInterface;
13+
use Magento\Framework\View\Element\UiComponent\DataProvider\Reporting;
14+
15+
class DataProviderTest extends \PHPUnit_Framework_TestCase
16+
{
17+
const TEST_REQUEST_NAME = 'test_request_name';
18+
19+
/**
20+
* @var DataProvider
21+
*/
22+
protected $model;
23+
24+
/**
25+
* @var Reporting | \PHPUnit_Framework_MockObject_MockObject
26+
*/
27+
protected $reporting;
28+
29+
/**
30+
* @var SearchCriteriaInterface | \PHPUnit_Framework_MockObject_MockObject
31+
*/
32+
protected $searchCriteria;
33+
34+
/**
35+
* @var \Magento\Framework\App\RequestInterface | \PHPUnit_Framework_MockObject_MockObject
36+
*/
37+
protected $request;
38+
39+
/**
40+
* @var FilterBuilder | \PHPUnit_Framework_MockObject_MockObject
41+
*/
42+
protected $filterBuilder;
43+
44+
/**
45+
* @var AttributeRepository | \PHPUnit_Framework_MockObject_MockObject
46+
*/
47+
protected $attributeRepository;
48+
49+
public function setUp()
50+
{
51+
$this->reporting = $this->getMockBuilder('Magento\Framework\View\Element\UiComponent\DataProvider\Reporting')
52+
->disableOriginalConstructor()
53+
->getMock();
54+
55+
$searchCriteriaBuilder = $this->mockSearchCriteria();
56+
57+
$this->request = $this->getMockBuilder('Magento\Framework\App\RequestInterface')
58+
->getMockForAbstractClass();
59+
60+
$this->filterBuilder = $this->getMockBuilder('Magento\Framework\Api\FilterBuilder')
61+
->disableOriginalConstructor()
62+
->getMock();
63+
64+
$this->attributeRepository = $this->getMockBuilder('Magento\Customer\Ui\Component\Listing\AttributeRepository')
65+
->disableOriginalConstructor()
66+
->getMock();
67+
68+
$this->model = new DataProvider(
69+
self::TEST_REQUEST_NAME,
70+
'',
71+
'',
72+
$this->reporting,
73+
$searchCriteriaBuilder,
74+
$this->request,
75+
$this->filterBuilder,
76+
$this->attributeRepository
77+
);
78+
}
79+
80+
public function testGetData()
81+
{
82+
$attributeCode = 'attribute_code';
83+
$attributeValue = [
84+
AttributeMetadataInterface::OPTIONS => [
85+
[
86+
'label' => 'opt1_label',
87+
'value' => 'opt1_value',
88+
],
89+
],
90+
];
91+
92+
$expected = [
93+
[
94+
'attribute_code' => ['opt1_value'],
95+
],
96+
];
97+
98+
$attributeMock = $this->getMockBuilder('Magento\Framework\Api\AttributeInterface')
99+
->getMockForAbstractClass();
100+
$attributeMock->expects($this->once())
101+
->method('getAttributeCode')
102+
->willReturn($attributeCode);
103+
$attributeMock->expects($this->once())
104+
->method('getValue')
105+
->willReturn('opt1_value');
106+
107+
$searchDocumentMock = $this->getMockBuilder('Magento\Framework\Api\Search\DocumentInterface')
108+
->getMockForAbstractClass();
109+
$searchDocumentMock->expects($this->once())
110+
->method('getCustomAttributes')
111+
->willReturn([$attributeMock]);
112+
113+
$searchResultMock = $this->getMockBuilder('Magento\Framework\Api\Search\SearchResultInterface')
114+
->getMockForAbstractClass();
115+
$searchResultMock->expects($this->once())
116+
->method('getTotalCount')
117+
->willReturn(1);
118+
$searchResultMock->expects($this->once())
119+
->method('getItems')
120+
->willReturn([$searchDocumentMock]);
121+
122+
$this->searchCriteria->expects($this->once())
123+
->method('setRequestName')
124+
->with(self::TEST_REQUEST_NAME)
125+
->willReturnSelf();
126+
127+
$this->reporting->expects($this->once())
128+
->method('search')
129+
->with($this->searchCriteria)
130+
->willReturn($searchResultMock);
131+
132+
$this->attributeRepository->expects($this->once())
133+
->method('getList')
134+
->willReturn([$attributeCode => $attributeValue]);
135+
136+
$result = $this->model->getData();
137+
138+
$this->assertTrue(is_array($result));
139+
$this->assertArrayHasKey('totalRecords', $result);
140+
$this->assertEquals(1, $result['totalRecords']);
141+
$this->assertArrayHasKey('items', $result);
142+
$this->assertTrue(is_array($result['items']));
143+
$this->assertEquals($result['items'], $expected);
144+
}
145+
146+
/**
147+
* @return \PHPUnit_Framework_MockObject_MockObject
148+
*/
149+
protected function mockSearchCriteria()
150+
{
151+
$this->searchCriteria = $this->getMockBuilder('Magento\Framework\Api\Search\SearchCriteriaInterface')
152+
->getMockForAbstractClass();
153+
154+
$searchCriteriaBuilder = $this->getMockBuilder('Magento\Framework\Api\Search\SearchCriteriaBuilder')
155+
->disableOriginalConstructor()
156+
->getMock();
157+
158+
$searchCriteriaBuilder->expects($this->any())
159+
->method('create')
160+
->willReturn($this->searchCriteria);
161+
162+
return $searchCriteriaBuilder;
163+
}
164+
}

app/code/Magento/Customer/view/frontend/templates/js/customer-data.phtml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
'*' => ['Magento_Customer/js/customer-data' => [
1414
'sectionLoadUrl' => $block->getCustomerDataUrl('customer/section/load'),
1515
'cookieLifeTime' => $block->getCookieLifeTime(),
16-
'nonCachedSections' => $block->getNonCachedSectionKeys(),
1716
]],
1817
]);
1918
?>

app/code/Magento/Customer/view/frontend/web/js/customer-data.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ define([
2323
storage.removeAll();
2424
var date = new Date(Date.now() + parseInt(options.cookieLifeTime, 10) * 1000);
2525
$.localStorage.set('mage-cache-timeout', date);
26-
} else {
27-
invalidateNonCachedSections(options);
2826
}
2927
};
3028

@@ -35,12 +33,6 @@ define([
3533
}
3634
};
3735

38-
var invalidateNonCachedSections = function(options) {
39-
_.each(options.nonCachedSections, function (sectionName) {
40-
storageInvalidation.set(sectionName, true);
41-
});
42-
}
43-
4436
var dataProvider = {
4537
getFromStorage: function (sectionNames) {
4638
var result = {};

app/code/Magento/SampleData/Model/BlackHole.php

Lines changed: 0 additions & 22 deletions
This file was deleted.

app/code/Magento/SampleData/etc/di.xml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,4 @@
1515
</argument>
1616
</arguments>
1717
</type>
18-
<virtualType name="Magento\SampleData\Model\BlackHoleFactory" type="\Magento\Framework\Mail\TransportInterfaceFactory">
19-
<arguments>
20-
<argument name="instanceName" xsi:type="string">Magento\SampleData\Model\BlackHole</argument>
21-
</arguments>
22-
</virtualType>
23-
<virtualType name="blackHoleTransportBuilder" type="Magento\Framework\Mail\Template\TransportBuilder">
24-
<arguments>
25-
<argument name="mailTransportFactory" xsi:type="object" >Magento\SampleData\Model\BlackHoleFactory</argument>
26-
</arguments>
27-
</virtualType>
28-
<virtualType name="sampleDataAccountManagement" type="Magento\Customer\Model\AccountManagement">
29-
<arguments>
30-
<argument name="transportBuilder" xsi:type="object">blackHoleTransportBuilder</argument>
31-
</arguments>
32-
</virtualType>
33-
<type name="Magento\SampleData\Module\Customer\Setup\Customer">
34-
<arguments>
35-
<argument name="accountManagement" xsi:type="object">sampleDataAccountManagement</argument>
36-
</arguments>
37-
</type>
3818
</config>

0 commit comments

Comments
 (0)