Skip to content

Commit 3a61096

Browse files
author
Magento CICD
authored
merge magento/2.2-develop into magento-helix/MAGETWO-71434
2 parents 43ac739 + 6df4b3c commit 3a61096

File tree

40 files changed

+976
-223
lines changed

40 files changed

+976
-223
lines changed

app/code/Magento/Backend/Block/Template.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,22 @@ public function getFormKey()
8585
*
8686
* @param string $moduleName Full module name
8787
* @return boolean
88-
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
89-
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
88+
* @deprecated 100.2.0 Magento does not support disabling/enabling modules output from the Admin Panel since 2.2.0
89+
* version. Module output can still be enabled/disabled in configuration files. However, this functionality should
90+
* not be used in future development. Module design should explicitly state dependencies to avoid requiring output
91+
* disabling. This functionality will temporarily be kept in Magento core, as there are unresolved modularity
92+
* issues that will be addressed in future releases.
9093
*/
9194
public function isOutputEnabled($moduleName = null)
9295
{
93-
return true;
96+
if ($moduleName === null) {
97+
$moduleName = $this->getModuleName();
98+
}
99+
100+
return !$this->_scopeConfig->isSetFlag(
101+
'advanced/modules_disable_output/' . $moduleName,
102+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
103+
);
94104
}
95105

96106
/**

app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Options/AjaxTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ public function testToHtml()
5858
->getMock();
5959
$eventManager->expects($this->exactly(2))->method('dispatch')->will($this->returnValue(true));
6060

61+
$scopeConfig = $this->getMockBuilder(\Magento\Framework\App\Config::class)
62+
->setMethods(['getValue'])
63+
->disableOriginalConstructor()->getMock();
64+
$scopeConfig->expects($this->once())->method('getValue')->withAnyParameters()
65+
->will($this->returnValue(false));
66+
6167
$product = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)->disableOriginalConstructor()
6268
->setMethods(['setStoreId', 'load', 'getId', '__wakeup', '__sleep'])
6369
->getMock();
@@ -90,6 +96,8 @@ public function testToHtml()
9096

9197
$this->context->expects($this->once())->method('getEventManager')
9298
->will($this->returnValue($eventManager));
99+
$this->context->expects($this->once())->method('getScopeConfig')
100+
->will($this->returnValue($scopeConfig));
93101
$this->context->expects($this->once())->method('getLayout')
94102
->will($this->returnValue($layout));
95103
$this->context->expects($this->once())->method('getRequest')

app/code/Magento/Catalog/Test/Unit/Block/Product/Widget/NewWidgetTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ protected function generalGetProductCollection()
186186
{
187187
$this->eventManager->expects($this->exactly(2))->method('dispatch')
188188
->will($this->returnValue(true));
189+
$this->scopeConfig->expects($this->once())->method('getValue')->withAnyParameters()
190+
->willReturn(false);
189191
$this->cacheState->expects($this->atLeastOnce())->method('isEnabled')->withAnyParameters()
190192
->willReturn(false);
191193
$this->catalogConfig->expects($this->once())->method('getProductAttributes')

app/code/Magento/Catalog/view/frontend/templates/product/widget/viewed/sidebar.phtml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@
1717
'listing' => [
1818
'displayMode' => 'grid'
1919
],
20-
'column' => [
21-
'image' => [
22-
'imageCode' => 'recently_viewed_products_images_names_widget'
23-
]
20+
'image' => [
21+
'imageCode' => 'recently_viewed_products_images_names_widget'
2422
]
2523
]
2624
);

app/code/Magento/CatalogSearch/Model/Layer/Filter/Price.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ public function getCurrencyRate()
175175
*/
176176
protected function _renderRangeLabel($fromPrice, $toPrice)
177177
{
178+
$fromPrice = empty($fromPrice) ? 0 : $fromPrice * $this->getCurrencyRate();
179+
$toPrice = empty($toPrice) ? $toPrice : $toPrice * $this->getCurrencyRate();
180+
178181
$formattedFromPrice = $this->priceCurrency->format($fromPrice);
179182
if ($toPrice === '') {
180183
return __('%1 and above', $formattedFromPrice);
@@ -261,10 +264,7 @@ private function prepareData($key, $count)
261264
if ($to == '*') {
262265
$to = $this->getTo($to);
263266
}
264-
$label = $this->_renderRangeLabel(
265-
empty($from) ? 0 : $from * $this->getCurrencyRate(),
266-
empty($to) ? $to : $to * $this->getCurrencyRate()
267-
);
267+
$label = $this->_renderRangeLabel($from, $to);
268268
$value = $from . '-' . $to . $this->dataProvider->getAdditionalRequestData();
269269

270270
$data = [

app/code/Magento/CatalogSearch/Test/Unit/Model/Layer/Filter/PriceTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ function ($field) use ($requestVar, $priceId) {
225225
->with('price')
226226
->will($this->returnSelf());
227227

228+
$this->target->setCurrencyRate(1);
228229
$this->target->apply($this->request);
229230
}
230231

app/code/Magento/Checkout/Test/Unit/Block/Cart/Item/Renderer/ActionsTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ public function testToHtml()
6868
$childNameTwo = 'child.2';
6969
$childNames = [$childNameOne, $childNameTwo];
7070

71+
$this->scopeConfigMock->expects($this->once())
72+
->method('getValue')
73+
->willReturn(false);
74+
7175
/**
7276
* @var Item|\PHPUnit_Framework_MockObject_MockObject $itemMock
7377
*/

app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<div class="shipping-address-item" data-bind="css: isSelected() ? 'selected-item' : 'not-selected-item'">
88
<!-- ko text: address().prefix --><!-- /ko --> <!-- ko text: address().firstname --><!-- /ko --> <!-- ko text: address().middlename --><!-- /ko -->
99
<!-- ko text: address().lastname --><!-- /ko --> <!-- ko text: address().suffix --><!-- /ko --><br/>
10-
<!-- ko text: address().street --><!-- /ko --><br/>
10+
<!-- ko text: _.values(address().street).join(", ") --><!-- /ko --><br/>
1111
<!-- ko text: address().city --><!-- /ko -->, <span data-bind="html: address().region"></span> <!-- ko text: address().postcode --><!-- /ko --><br/>
1212
<!-- ko text: getCountryName(address().countryId) --><!-- /ko --><br/>
1313
<!-- ko if: (address().telephone) -->

app/code/Magento/Config/Block/System/Config/Form/Fieldset/Modules/DisableOutput.php

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,37 @@
1010
* on the store settings page.
1111
*
1212
* @method \Magento\Config\Block\System\Config\Form getForm()
13-
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
13+
* @deprecated 100.2.0 Magento does not support disabling/enabling modules output from the Admin Panel since 2.2.0
14+
* version. Module output can still be enabled/disabled in configuration files. However, this functionality should
15+
* not be used in future development. Module design should explicitly state dependencies to avoid requiring output
16+
* disabling. This functionality will temporarily be kept in Magento core, as there are unresolved modularity
17+
* issues that will be addressed in future releases.
1418
* @api
1519
* @since 100.0.2
1620
*/
1721
class DisableOutput extends \Magento\Config\Block\System\Config\Form\Fieldset
1822
{
1923
/**
2024
* @var \Magento\Framework\DataObject
21-
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
25+
* @deprecated 100.2.0
2226
*/
2327
protected $_dummyElement;
2428

2529
/**
2630
* @var \Magento\Config\Block\System\Config\Form\Field
27-
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
31+
* @deprecated 100.2.0
2832
*/
2933
protected $_fieldRenderer;
3034

3135
/**
3236
* @var array
33-
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
37+
* @deprecated 100.2.0
3438
*/
3539
protected $_values;
3640

3741
/**
3842
* @var \Magento\Framework\Module\ModuleListInterface
39-
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
43+
* @deprecated 100.2.0
4044
*/
4145
protected $_moduleList;
4246

@@ -60,7 +64,11 @@ public function __construct(
6064

6165
/**
6266
* {@inheritdoc}
63-
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
67+
* @deprecated 100.2.0 Magento does not support disabling/enabling modules output from the Admin Panel since 2.2.0
68+
* version. Module output can still be enabled/disabled in configuration files. However, this functionality should
69+
* not be used in future development. Module design should explicitly state dependencies to avoid requiring output
70+
* disabling. This functionality will temporarily be kept in Magento core, as there are unresolved modularity
71+
* issues that will be addressed in future releases.
6472
*/
6573
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
6674
{
@@ -89,7 +97,7 @@ public function render(\Magento\Framework\Data\Form\Element\AbstractElement $ele
8997
}
9098

9199
/**
92-
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
100+
* @deprecated 100.2.0
93101
* @return \Magento\Framework\DataObject
94102
*/
95103
protected function _getDummyElement()
@@ -101,7 +109,7 @@ protected function _getDummyElement()
101109
}
102110

103111
/**
104-
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
112+
* @deprecated 100.2.0
105113
* @return \Magento\Config\Block\System\Config\Form\Field
106114
*/
107115
protected function _getFieldRenderer()
@@ -115,7 +123,7 @@ protected function _getFieldRenderer()
115123
}
116124

117125
/**
118-
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
126+
* @deprecated 100.2.0
119127
* @return array
120128
*/
121129
protected function _getValues()
@@ -132,7 +140,7 @@ protected function _getValues()
132140
/**
133141
* @param \Magento\Framework\Data\Form\Element\Fieldset $fieldset
134142
* @param string $moduleName
135-
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
143+
* @deprecated 100.2.0
136144
* @return mixed
137145
*/
138146
protected function _getFieldHtml($fieldset, $moduleName)

app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Fieldset/Modules/DisableOutputTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
/**
99
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
10-
* @deprecated because \Magento\Config\Block\System\Config\Form\Fieldset\Modules\DisableOutput is deprecated
1110
*/
1211
class DisableOutputTest extends \PHPUnit\Framework\TestCase
1312
{
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Deploy\App\Mode;
7+
8+
/**
9+
* This class is responsible for providing configuration while switching application mode
10+
*/
11+
class ConfigProvider
12+
{
13+
/**
14+
* Configuration for combinations of $currentMode and $targetMode
15+
* For example:
16+
* [
17+
* 'developer' => [
18+
* 'production' => [
19+
* {{setting_path}} => {{setting_value}}
20+
* ]
21+
* ]
22+
* ]
23+
*
24+
* @var array
25+
*/
26+
private $config;
27+
28+
/**
29+
* @param array $config
30+
*/
31+
public function __construct(array $config = [])
32+
{
33+
$this->config = $config;
34+
}
35+
36+
/**
37+
* Provide configuration while switching from $currentMode to $targetMode
38+
* This method used in \Magento\Deploy\Model\Mode::setStoreMode
39+
*
40+
* For example: while switching from developer mode to production mode
41+
* need to turn off 'dev/debug/debug_logging' setting in this case method
42+
* will return array
43+
* [
44+
* {{setting_path}} => {{setting_value}}
45+
* ]
46+
*
47+
* @param string $currentMode
48+
* @param string $targetMode
49+
* @return array
50+
*/
51+
public function getConfigs($currentMode, $targetMode)
52+
{
53+
if (isset($this->config[$currentMode][$targetMode])) {
54+
return $this->config[$currentMode][$targetMode];
55+
}
56+
return [];
57+
}
58+
}

0 commit comments

Comments
 (0)