Skip to content

Commit

Permalink
merge magento/2.2-develop into magento-helix/MAGETWO-71434
Browse files Browse the repository at this point in the history
  • Loading branch information
Magento CICD authored Aug 16, 2017
2 parents 43ac739 + 6df4b3c commit 3a61096
Show file tree
Hide file tree
Showing 40 changed files with 976 additions and 223 deletions.
16 changes: 13 additions & 3 deletions app/code/Magento/Backend/Block/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,22 @@ public function getFormKey()
*
* @param string $moduleName Full module name
* @return boolean
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @deprecated 100.2.0 Magento does not support disabling/enabling modules output from the Admin Panel since 2.2.0
* version. Module output can still be enabled/disabled in configuration files. However, this functionality should
* not be used in future development. Module design should explicitly state dependencies to avoid requiring output
* disabling. This functionality will temporarily be kept in Magento core, as there are unresolved modularity
* issues that will be addressed in future releases.
*/
public function isOutputEnabled($moduleName = null)
{
return true;
if ($moduleName === null) {
$moduleName = $this->getModuleName();
}

return !$this->_scopeConfig->isSetFlag(
'advanced/modules_disable_output/' . $moduleName,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ public function testToHtml()
->getMock();
$eventManager->expects($this->exactly(2))->method('dispatch')->will($this->returnValue(true));

$scopeConfig = $this->getMockBuilder(\Magento\Framework\App\Config::class)
->setMethods(['getValue'])
->disableOriginalConstructor()->getMock();
$scopeConfig->expects($this->once())->method('getValue')->withAnyParameters()
->will($this->returnValue(false));

$product = $this->getMockBuilder(\Magento\Catalog\Model\Product::class)->disableOriginalConstructor()
->setMethods(['setStoreId', 'load', 'getId', '__wakeup', '__sleep'])
->getMock();
Expand Down Expand Up @@ -90,6 +96,8 @@ public function testToHtml()

$this->context->expects($this->once())->method('getEventManager')
->will($this->returnValue($eventManager));
$this->context->expects($this->once())->method('getScopeConfig')
->will($this->returnValue($scopeConfig));
$this->context->expects($this->once())->method('getLayout')
->will($this->returnValue($layout));
$this->context->expects($this->once())->method('getRequest')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ protected function generalGetProductCollection()
{
$this->eventManager->expects($this->exactly(2))->method('dispatch')
->will($this->returnValue(true));
$this->scopeConfig->expects($this->once())->method('getValue')->withAnyParameters()
->willReturn(false);
$this->cacheState->expects($this->atLeastOnce())->method('isEnabled')->withAnyParameters()
->willReturn(false);
$this->catalogConfig->expects($this->once())->method('getProductAttributes')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
'listing' => [
'displayMode' => 'grid'
],
'column' => [
'image' => [
'imageCode' => 'recently_viewed_products_images_names_widget'
]
'image' => [
'imageCode' => 'recently_viewed_products_images_names_widget'
]
]
);
8 changes: 4 additions & 4 deletions app/code/Magento/CatalogSearch/Model/Layer/Filter/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ public function getCurrencyRate()
*/
protected function _renderRangeLabel($fromPrice, $toPrice)
{
$fromPrice = empty($fromPrice) ? 0 : $fromPrice * $this->getCurrencyRate();
$toPrice = empty($toPrice) ? $toPrice : $toPrice * $this->getCurrencyRate();

$formattedFromPrice = $this->priceCurrency->format($fromPrice);
if ($toPrice === '') {
return __('%1 and above', $formattedFromPrice);
Expand Down Expand Up @@ -261,10 +264,7 @@ private function prepareData($key, $count)
if ($to == '*') {
$to = $this->getTo($to);
}
$label = $this->_renderRangeLabel(
empty($from) ? 0 : $from * $this->getCurrencyRate(),
empty($to) ? $to : $to * $this->getCurrencyRate()
);
$label = $this->_renderRangeLabel($from, $to);
$value = $from . '-' . $to . $this->dataProvider->getAdditionalRequestData();

$data = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ function ($field) use ($requestVar, $priceId) {
->with('price')
->will($this->returnSelf());

$this->target->setCurrencyRate(1);
$this->target->apply($this->request);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ public function testToHtml()
$childNameTwo = 'child.2';
$childNames = [$childNameOne, $childNameTwo];

$this->scopeConfigMock->expects($this->once())
->method('getValue')
->willReturn(false);

/**
* @var Item|\PHPUnit_Framework_MockObject_MockObject $itemMock
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="shipping-address-item" data-bind="css: isSelected() ? 'selected-item' : 'not-selected-item'">
<!-- ko text: address().prefix --><!-- /ko --> <!-- ko text: address().firstname --><!-- /ko --> <!-- ko text: address().middlename --><!-- /ko -->
<!-- ko text: address().lastname --><!-- /ko --> <!-- ko text: address().suffix --><!-- /ko --><br/>
<!-- ko text: address().street --><!-- /ko --><br/>
<!-- ko text: _.values(address().street).join(", ") --><!-- /ko --><br/>
<!-- ko text: address().city --><!-- /ko -->, <span data-bind="html: address().region"></span> <!-- ko text: address().postcode --><!-- /ko --><br/>
<!-- ko text: getCountryName(address().countryId) --><!-- /ko --><br/>
<!-- ko if: (address().telephone) -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,37 @@
* on the store settings page.
*
* @method \Magento\Config\Block\System\Config\Form getForm()
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
* @deprecated 100.2.0 Magento does not support disabling/enabling modules output from the Admin Panel since 2.2.0
* version. Module output can still be enabled/disabled in configuration files. However, this functionality should
* not be used in future development. Module design should explicitly state dependencies to avoid requiring output
* disabling. This functionality will temporarily be kept in Magento core, as there are unresolved modularity
* issues that will be addressed in future releases.
* @api
* @since 100.0.2
*/
class DisableOutput extends \Magento\Config\Block\System\Config\Form\Fieldset
{
/**
* @var \Magento\Framework\DataObject
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
* @deprecated 100.2.0
*/
protected $_dummyElement;

/**
* @var \Magento\Config\Block\System\Config\Form\Field
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
* @deprecated 100.2.0
*/
protected $_fieldRenderer;

/**
* @var array
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
* @deprecated 100.2.0
*/
protected $_values;

/**
* @var \Magento\Framework\Module\ModuleListInterface
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
* @deprecated 100.2.0
*/
protected $_moduleList;

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

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

/**
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
* @deprecated 100.2.0
* @return \Magento\Framework\DataObject
*/
protected function _getDummyElement()
Expand All @@ -101,7 +109,7 @@ protected function _getDummyElement()
}

/**
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
* @deprecated 100.2.0
* @return \Magento\Config\Block\System\Config\Form\Field
*/
protected function _getFieldRenderer()
Expand All @@ -115,7 +123,7 @@ protected function _getFieldRenderer()
}

/**
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
* @deprecated 100.2.0
* @return array
*/
protected function _getValues()
Expand All @@ -132,7 +140,7 @@ protected function _getValues()
/**
* @param \Magento\Framework\Data\Form\Element\Fieldset $fieldset
* @param string $moduleName
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
* @deprecated 100.2.0
* @return mixed
*/
protected function _getFieldHtml($fieldset, $moduleName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @deprecated because \Magento\Config\Block\System\Config\Form\Fieldset\Modules\DisableOutput is deprecated
*/
class DisableOutputTest extends \PHPUnit\Framework\TestCase
{
Expand Down
58 changes: 58 additions & 0 deletions app/code/Magento/Deploy/App/Mode/ConfigProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Deploy\App\Mode;

/**
* This class is responsible for providing configuration while switching application mode
*/
class ConfigProvider
{
/**
* Configuration for combinations of $currentMode and $targetMode
* For example:
* [
* 'developer' => [
* 'production' => [
* {{setting_path}} => {{setting_value}}
* ]
* ]
* ]
*
* @var array
*/
private $config;

/**
* @param array $config
*/
public function __construct(array $config = [])
{
$this->config = $config;
}

/**
* Provide configuration while switching from $currentMode to $targetMode
* This method used in \Magento\Deploy\Model\Mode::setStoreMode
*
* For example: while switching from developer mode to production mode
* need to turn off 'dev/debug/debug_logging' setting in this case method
* will return array
* [
* {{setting_path}} => {{setting_value}}
* ]
*
* @param string $currentMode
* @param string $targetMode
* @return array
*/
public function getConfigs($currentMode, $targetMode)
{
if (isset($this->config[$currentMode][$targetMode])) {
return $this->config[$currentMode][$targetMode];
}
return [];
}
}
Loading

0 comments on commit 3a61096

Please sign in to comment.