Skip to content

Commit 9f2eede

Browse files
committed
MC-29795: Some environment variables do not lock the settings in the backend
1 parent 2e995b9 commit 9f2eede

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

app/code/Magento/Config/Block/System/Config/Form/Field.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ public function render(\Magento\Framework\Data\Form\Element\AbstractElement $ele
4343
$element->setDisabled(true);
4444
}
4545

46+
if ($element->getIsDisableInheritance()) {
47+
$element->setReadonly(true);
48+
}
49+
4650
$html = '<td class="label"><label for="' .
4751
$element->getHtmlId() . '"><span' .
4852
$this->_renderScopeLabel($element) . '>' .

app/code/Magento/Config/Test/Unit/Block/System/Config/Form/FieldTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
/**
99
* Test how class render field html element in Stores Configuration
10-
*
11-
* @package Magento\Config\Test\Unit\Block\System\Config\Form
1210
*/
1311
class FieldTest extends \PHPUnit\Framework\TestCase
1412
{
@@ -72,6 +70,7 @@ protected function setUp()
7270
'getCanUseDefaultValue',
7371
'setDisabled',
7472
'getTooltip',
73+
'setReadonly'
7574
]
7675
);
7776

@@ -179,7 +178,8 @@ public function testRenderInheritCheckbox()
179178
$this->_elementMock->expects($this->any())->method('getCanUseWebsiteValue')->will($this->returnValue(true));
180179
$this->_elementMock->expects($this->any())->method('getCanUseDefaultValue')->will($this->returnValue(true));
181180
$this->_elementMock->expects($this->once())->method('setDisabled')->with(true);
182-
$this->_elementMock->expects($this->once())->method('getIsDisableInheritance')->willReturn(true);
181+
$this->_elementMock->method('getIsDisableInheritance')->willReturn(true);
182+
$this->_elementMock->method('setReadonly')->with(true);
183183

184184
$expected = '<td class="use-default">';
185185
$expected .= '<input id="' .

0 commit comments

Comments
 (0)