Skip to content

Commit 7d8a80d

Browse files
author
Olexii Korshenko
committed
Merge branch 'mainline-develop' into checkout
2 parents a508a77 + 485c067 commit 7d8a80d

File tree

100 files changed

+4059
-1503
lines changed

Some content is hidden

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

100 files changed

+4059
-1503
lines changed

.travis.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ env:
99
- TEST_SUITE=integration_integrity
1010
- TEST_SUITE=static_phpcs
1111
- TEST_SUITE=static_annotation
12+
cache:
13+
apt: true
14+
directories:
15+
- $HOME/.composer/cache
16+
- $HOME/.cache/bin
1217
matrix:
1318
exclude:
1419
- php: 5.6
@@ -18,6 +23,16 @@ matrix:
1823
before_install:
1924
- sudo apt-get update -qq
2025
- sudo apt-get install -y -qq postfix
26+
- sh -c 'if [ "$CASHER_DIR" ]; then
27+
if [ -x $HOME/.cache/bin/composer ]; then
28+
$HOME/.cache/bin/composer self-update; echo '';
29+
else
30+
mkdir -p $HOME/.cache/bin;
31+
curl --connect-timeout 30 -sS https://getcomposer.org/installer \
32+
| php -- --install-dir $HOME/.cache/bin/ --filename composer;
33+
fi
34+
fi'
35+
- export PATH="$HOME/.cache/bin:$PATH"
2136
before_script:
2237
# Mock mail
2338
- sudo service postfix stop
@@ -46,7 +61,7 @@ before_script:
4661
# Change memory_limit for travis
4762
- echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
4863
- phpenv rehash;
49-
- composer install --no-interaction --dev
64+
- composer install --no-interaction --prefer-dist
5065
script:
5166
# Unit tests
5267
- sh -c "if [ '$TEST_SUITE' = 'unit' ]; then ./vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist; fi"
@@ -59,4 +74,4 @@ script:
5974
# Static tests [Code Style]
6075
- sh -c "if [ '$TEST_SUITE' = 'static_phpcs' ]; then cd dev/tests/static; ./../../../vendor/bin/phpunit -c phpunit.xml.dist --filter 'Magento\\\\Test\\\\Php\\\\LiveCodeTest::testCodeStyle'; fi"
6176
# Static tests [Code Style]
62-
- sh -c "if [ '$TEST_SUITE' = 'static_annotation' ]; then cd dev/tests/static; ./../../../vendor/bin/phpunit -c phpunit.xml.dist --filter 'Magento\\\\Test\\\\Php\\\\LiveCodeTest::testAnnotationStandard'; fi"
77+
- sh -c "if [ '$TEST_SUITE' = 'static_annotation' ]; then cd dev/tests/static; ./../../../vendor/bin/phpunit -c phpunit.xml.dist --filter 'Magento\\\\Test\\\\Php\\\\LiveCodeTest::testAnnotationStandard'; fi"

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,6 @@
137137
<comment>Alternative text for next link in pagination menu. If empty, default arrow image will used.</comment>
138138
</field>
139139
</group>
140-
<group id="email" translate="label" type="text" sortOrder="510" showInDefault="1" showInWebsite="1" showInStore="1">
141-
<label>Transactional Emails</label>
142-
<field id="logo" translate="label" type="image" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
143-
<label>Logo Image</label>
144-
<comment>Allowed file types: jpg, jpeg, gif, png</comment>
145-
<backend_model>Magento\Config\Model\Config\Backend\Email\Logo</backend_model>
146-
<base_url type="media" scope_info="1">email/logo</base_url>
147-
</field>
148-
<field id="logo_alt" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
149-
<label>Logo Image Alt</label>
150-
</field>
151-
</group>
152140
</section>
153141
<section id="dev" translate="label" type="text" sortOrder="920" showInDefault="1" showInWebsite="1" showInStore="1">
154142
<label>Developer</label>
@@ -287,6 +275,9 @@
287275
<field id="phone" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
288276
<label>Store Phone Number</label>
289277
</field>
278+
<field id="hours" translate="label" type="text" sortOrder="22" showInDefault="1" showInWebsite="1" showInStore="1">
279+
<label>Store Hours of Operation</label>
280+
</field>
290281
<field id="country_id" translate="label" type="select" sortOrder="25" showInDefault="1" showInWebsite="1" showInStore="0">
291282
<label>Country</label>
292283
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>

app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Main.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ protected function _prepareForm()
7070
}
7171
$this->_coreRegistry->register('attribute_type_hidden_fields', $_hiddenFields);
7272

73+
$this->_eventManager->dispatch('product_attribute_form_build_main_tab', ['form' => $form]);
74+
7375
$frontendInputValues = array_merge($frontendInputElm->getValues(), $additionalTypes);
7476
$frontendInputElm->setValues($frontendInputValues);
7577

app/code/Magento/Catalog/Model/Template/Filter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function setUseSessionInUrl($flag)
9393
*/
9494
public function viewDirective($construction)
9595
{
96-
$params = $this->_getIncludeParameters($construction[2]);
96+
$params = $this->_getParameters($construction[2]);
9797
$params['_absolute'] = $this->_useAbsoluteLinks;
9898
/**
9999
* @bug: the "_absolute" key is not supported by underlying services
@@ -122,7 +122,7 @@ public function viewDirective($construction)
122122
*/
123123
public function mediaDirective($construction)
124124
{
125-
$params = $this->_getIncludeParameters($construction[2]);
125+
$params = $this->_getParameters($construction[2]);
126126
return $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . $params['url'];
127127
}
128128

@@ -136,7 +136,7 @@ public function mediaDirective($construction)
136136
*/
137137
public function storeDirective($construction)
138138
{
139-
$params = $this->_getIncludeParameters($construction[2]);
139+
$params = $this->_getParameters($construction[2]);
140140
if (!isset($params['_query'])) {
141141
$params['_query'] = [];
142142
}

app/code/Magento/Cms/Model/Template/Filter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function setUseSessionInUrl($flag)
3737
*/
3838
public function mediaDirective($construction)
3939
{
40-
$params = $this->_getIncludeParameters($construction[2]);
40+
$params = $this->_getParameters($construction[2]);
4141
return $this->_storeManager->getStore()->getBaseMediaDir() . '/' . $params['url'];
4242
}
4343
}

app/code/Magento/ConfigurableProduct/Model/SuggestedAttributeList.php

Lines changed: 11 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -14,47 +14,24 @@ class SuggestedAttributeList
1414
*
1515
* @var \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory
1616
*/
17-
protected $attributeCollectionFactory;
18-
17+
protected $_attributeColFactory;
1918
/**
2019
* Catalog resource helper
2120
*
2221
* @var \Magento\Catalog\Model\Resource\Helper
2322
*/
24-
protected $resourceHelper;
25-
26-
/**
27-
* Application Event Dispatcher
28-
*
29-
* @var \Magento\Framework\Event\ManagerInterface
30-
*/
31-
protected $eventManager;
32-
33-
/**
34-
* Object Factory
35-
*
36-
* @var \Magento\Framework\ObjectFactory
37-
*/
38-
protected $objectFactory;
39-
23+
protected $_resourceHelper;
4024
/**
41-
* @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory
25+
* @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeColFactory
4226
* @param \Magento\Catalog\Model\Resource\Helper $resourceHelper
43-
* @param \Magento\Framework\Event\ManagerInterface $eventManager
44-
* @param \Magento\Framework\ObjectFactory $objectFactory
4527
*/
4628
public function __construct(
47-
\Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory,
48-
\Magento\Catalog\Model\Resource\Helper $resourceHelper,
49-
\Magento\Framework\Event\ManagerInterface $eventManager,
50-
\Magento\Framework\ObjectFactory $objectFactory
29+
\Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeColFactory,
30+
\Magento\Catalog\Model\Resource\Helper $resourceHelper
5131
) {
52-
$this->attributeCollectionFactory = $attributeCollectionFactory;
53-
$this->resourceHelper = $resourceHelper;
54-
$this->objectFactory = $objectFactory;
55-
$this->eventManager = $eventManager;
32+
$this->_attributeColFactory = $attributeColFactory;
33+
$this->_resourceHelper = $resourceHelper;
5634
}
57-
5835
/**
5936
* Retrieve list of attributes with admin store label containing $labelPart
6037
*
@@ -63,14 +40,12 @@ public function __construct(
6340
*/
6441
public function getSuggestedAttributes($labelPart)
6542
{
66-
$escapedLabelPart = $this->resourceHelper->addLikeEscape($labelPart, ['position' => 'any']);
67-
$availableFrontendTypes = $this->getAvailableFrontendTypes();
68-
43+
$escapedLabelPart = $this->_resourceHelper->addLikeEscape($labelPart, ['position' => 'any']);
6944
/** @var $collection \Magento\Catalog\Model\Resource\Product\Attribute\Collection */
70-
$collection = $this->attributeCollectionFactory->create();
45+
$collection = $this->_attributeColFactory->create();
7146
$collection->addFieldToFilter(
72-
'main_table.frontend_input',
73-
['in' => $availableFrontendTypes->getData('values')]
47+
'frontend_input',
48+
'select'
7449
)->addFieldToFilter(
7550
'frontend_label',
7651
['like' => $escapedLabelPart]
@@ -81,7 +56,6 @@ public function getSuggestedAttributes($labelPart)
8156
'is_global',
8257
\Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL
8358
);
84-
8559
$result = [];
8660
$types = [
8761
\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE,
@@ -101,22 +75,4 @@ public function getSuggestedAttributes($labelPart)
10175
}
10276
return $result;
10377
}
104-
105-
/**
106-
* @return \Magento\Framework\Object
107-
*/
108-
private function getAvailableFrontendTypes()
109-
{
110-
$availableFrontendTypes = $this->objectFactory->create();
111-
$availableFrontendTypes->setData(
112-
[
113-
'values' => ['select']
114-
]
115-
);
116-
$this->eventManager->dispatch(
117-
'product_suggested_attribute_frontend_type_init_after',
118-
['types_dto' => $availableFrontendTypes]
119-
);
120-
return $availableFrontendTypes;
121-
}
12278
}

app/code/Magento/ConfigurableProduct/Test/Unit/Model/SuggestedAttributeListTest.php

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@ class SuggestedAttributeListTest extends \PHPUnit_Framework_TestCase
2020
*/
2121
protected $attributeFactoryMock;
2222

23-
/**
24-
* @var \PHPUnit_Framework_MockObject_MockObject
25-
*/
26-
protected $eventManagerMock;
27-
28-
/**
29-
* @var \PHPUnit_Framework_MockObject_MockObject
30-
*/
31-
protected $objectFactoryMock;
32-
3323
/**
3424
* @var \PHPUnit_Framework_MockObject_MockObject
3525
*/
@@ -63,20 +53,6 @@ protected function setUp()
6353
'',
6454
false
6555
);
66-
$this->eventManagerMock = $this->getMock(
67-
'\Magento\Framework\Event\ManagerInterface',
68-
[],
69-
[],
70-
'',
71-
false
72-
);
73-
$this->objectFactoryMock = $this->getMock(
74-
'\Magento\Framework\ObjectFactory',
75-
['create'],
76-
[],
77-
'',
78-
false
79-
);
8056
$this->collectionMock = $this->getMock(
8157
'Magento\Catalog\Model\Resource\Product\Attribute\Collection',
8258
[],
@@ -102,7 +78,7 @@ protected function setUp()
10278
$this->returnValue($this->collectionMock)
10379
);
10480
$valueMap = [
105-
['main_table.frontend_input', ['in' => 123 ], $this->collectionMock],
81+
['frontend_input', 'select', $this->collectionMock],
10682
['frontend_label', ['like' => $this->labelPart], $this->collectionMock],
10783
['is_user_defined', 1, $this->collectionMock],
10884
['is_global', \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL, $this->collectionMock],
@@ -131,19 +107,12 @@ protected function setUp()
131107
);
132108
$this->suggestedListModel = new \Magento\ConfigurableProduct\Model\SuggestedAttributeList(
133109
$this->attributeFactoryMock,
134-
$this->resourceHelperMock,
135-
$this->eventManagerMock,
136-
$this->objectFactoryMock
110+
$this->resourceHelperMock
137111
);
138112
}
139113

140114
public function testGetSuggestedAttributesIfTheyApplicable()
141115
{
142-
$object = $this->getMock('\Magento\Framework\Object', [], [], '', false);
143-
$object->expects($this->once())->method('setData');
144-
$object->expects($this->once())->method('getData')->willReturn(123);
145-
$this->objectFactoryMock->expects($this->once())->method('create')->willReturn($object);
146-
147116
$source = $this->getMock(
148117
'Magento\Eav\Model\Entity\Attribute\Source\AbstractSource',
149118
[],
@@ -163,10 +132,6 @@ public function testGetSuggestedAttributesIfTheyApplicable()
163132

164133
public function testGetSuggestedAttributesIfTheyNotApplicable()
165134
{
166-
$object = $this->getMock('\Magento\Framework\Object', [], [], '', false);
167-
$object->expects($this->once())->method('setData');
168-
$object->expects($this->once())->method('getData')->willReturn(123);
169-
$this->objectFactoryMock->expects($this->once())->method('create')->willReturn($object);
170135
$this->attributeMock->expects($this->any())->method('getApplyTo')->will($this->returnValue(['simple']));
171136
$this->attributeMock->expects($this->never())->method('getId');
172137
$this->attributeMock->expects($this->never())->method('getFrontendLabel');

app/code/Magento/Email/Block/Adminhtml/Template/Preview.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,16 @@ public function __construct(
4747
*/
4848
protected function _toHtml()
4949
{
50+
$storeId = $this->getAnyStoreView()->getId();
51+
5052
/** @var $template \Magento\Email\Model\Template */
5153
$template = $this->_emailFactory->create(
52-
['data' => ['area' => \Magento\Framework\App\Area::AREA_FRONTEND]]
54+
['data' => [
55+
'area' => \Magento\Framework\App\Area::AREA_FRONTEND,
56+
'store' => $storeId
57+
]]
5358
);
54-
$id = (int)$this->getRequest()->getParam('id');
59+
$id = (int) $this->getRequest()->getParam('id');
5560
if ($id) {
5661
$template->load($id);
5762
} else {
@@ -63,14 +68,13 @@ protected function _toHtml()
6368
$template->setTemplateText($this->_maliciousCode->filter($template->getTemplateText()));
6469

6570
\Magento\Framework\Profiler::start("email_template_proccessing");
66-
$vars = [];
6771

68-
$store = $this->getAnyStoreView();
69-
$storeId = $store ? $store->getId() : null;
70-
$template->setDesignConfig(
71-
['area' => $this->_design->getArea(), 'store' => $storeId]
72+
$template->emulateDesign($storeId);
73+
$templateProcessed = $this->_appState->emulateAreaCode(
74+
\Magento\Email\Model\AbstractTemplate::DEFAULT_DESIGN_AREA,
75+
[$template, 'getProcessedTemplate']
7276
);
73-
$templateProcessed = $template->getProcessedTemplate($vars, true);
77+
$template->revertDesign();
7478

7579
if ($template->isPlain()) {
7680
$templateProcessed = "<pre>" . htmlspecialchars($templateProcessed) . "</pre>";

0 commit comments

Comments
 (0)